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
hi m8
post the script in full ..
Try replacing "math.max" with only "max".
Best regards,
jiten
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?
Replace this part of it:
possrights = {
hubadmin = 1,
opadmin = 1
}
Cheers
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!!!
Add this before "commands["vtip"] = function(user, arg)":
commands = {}
Cheers
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
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)