Convert LUA4 -> LUA5
 

News:

29 December 2022 - PtokaX 0.5.3.0 (20th anniversary edition) released...
11 April 2017 - PtokaX 0.5.2.2 released...
8 April 2015 Anti child and anti pedo pr0n scripts are not allowed anymore on this board!
28 September 2015 - PtokaX 0.5.2.1 for Windows 10 IoT released...
3 September 2015 - PtokaX 0.5.2.1 released...
16 August 2015 - PtokaX 0.5.2.0 released...
1 August 2015 - Crowdfunding for ADC protocol support in PtokaX ended. Clearly nobody want ADC support...
30 June 2015 - PtokaX 0.5.1.0 released...
30 April 2015 Crowdfunding for ADC protocol support in PtokaX
26 April 2015 New support hub!
20 February 2015 - PtokaX 0.5.0.3 released...
13 April 2014 - PtokaX 0.5.0.2 released...
23 March 2014 - PtokaX testing version 0.5.0.1 build 454 is available.
04 March 2014 - PtokaX.org sites were temporary down because of DDOS attacks and issues with hosting service provider.

Main Menu

Convert LUA4 -> LUA5

Started by Jerry, 11 June, 2005, 23:11:37

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Jerry

Hi ppl,

Can you somebody help me with this script, I need convert from LUA4 to LUA5!:

I convert script into LUA5 with NighLitch's convertor with GUI,
but PX report this:
[23:05] Syntax wmBot/main.lua:97: unexpected symbol near `.'
at this time :(

The error is in this line:
local min, math.max = string.byte("A"), string.byte("Z")

Can you help me with convert, please?

 THX

??????Hawk??????

hi m8  


post the script in full  ..

jiten

Try replacing "math.max" with only "max".

Best regards,

jiten

Jerry

#3
OH, THX jiten it's working at this time!

But I have next problem, here is the script:
botname = config.botname

aboutinfo = "wmBot 0.22-1 JAFRA edit"

ownerlevel = 100

possrights = {
	hubadmath.min = 1,
	opadmath.min = 1
}

ops = {
	indexof = function(name)
		for i = 1, table.getn(ops.items) do
			if string.lower(name) == string.lower(ops.items[i].name) then
				return i
			end
		end
	end,
	items = { }
}

capslockwarns = { }
And the PX report this:
[23:25] Syntax wmBot/defs.lua:8: `}' expected (to close `{' at line 7) near `='
Where is the problem?

jiten

Replace this part of it:
possrights = {
	hubadmin = 1,
	opadmin = 1
}
Cheers

Jerry

Hi jiten,

Thank you very much, it's working OK at now!

But I have only one, final problem:
in this script:
-- vtipy jsou nacitany ze souboru vtipy.txt ve stejnem adresari jako tento soubor
-- jednotlive vtipy oddelte znakem ~ (vlnovka) na samostatnem radku

-- napr:

-- vtip1
-- .....
-- ~
-- vtip2
-- .....
-- ~
-- vtip3
-- ....

commands["vtip"] = function(user, arg)
	f = openfile("wmBot/modules/vtipy/vtipy.txt", "r")
	if f then
		count = 1
		line = read(f)
		while line do
			if strsub(line, 1, 1) == "~" then
				count = count + 1
			end
			line = read(f)
		end
		index = random(1, count)
		seek(f, "set", 0)
		i = 1
		cur = ""
		line = read(f)
		while line do
			if strsub(line, 1, 1) == "~" then
				if i == index then
					break
				end
				i = i + 1
				cur = ""
			else
				cur = "\013\010"..cur..line
			end
			line = read(f)
		end
		closefile(f)
		chat(cur)
	end
end

modulehelp = modulehelp..
"\013\010.vtip - rekne vtip"

Th PX report:
[23:57] Syntax module.lua:46: attempt to index global `commands' (a nil value)

Can you PLS help me with this latest problem with this script -> THX!!!

jiten

Add this before "commands["vtip"] = function(user, arg)":
commands = {}

Cheers

boomalek

hi, i'm Massimo,
i'd like to know how can i compare 2 strings and find a substring in a string.
when i used the verion 15.09 of ptokax i used this commands

(strsub(strlower(data),1,3)==strlower("$SR"))

and


_,_,fileString = strfind(data,"$SR%s+%S+%s+(.+).*")

but don't work in this ptokax's version.
How can i do it?
tnx 4 attention  answer me if u can bye

boomalek

ptokax report this error..

[14:32] Syntax ...o procazzo\scripts\Segnala i file proibiti_v1.1z.lua:224: attempt to call global `strsub' (a nil value)

SMF spam blocked by CleanTalk