PtokaX forum

Archive => Archived 5.1 boards => Help with scripts => Topic started by: TopCat on 17 July, 2006, 13:35:28

Title: Shuckie Engl-lua 5.lua won't work in ptokax 0.3.5.0 lua 5.1
Post by: TopCat on 17 July, 2006, 13:35:28
Hi everybody? ;D
I'm trying to run this script in my new hub. but i'm getting the error [13:58] Syntax ...\0.3.5.0.lua5.1.1.dbg\scripts\Shuckie Engl-lua 5.lua:1929: attempt to call a table value. is that because it has to be converted to lua 5.1? And if so can anybody convert this for . Thx? ;)

Title: Re: Shuckie Engl-lua 5.lua won't work in ptokax 0.3.5.0 lua 5.1
Post by: 6Marilyn6Manson6 on 17 July, 2006, 14:07:29
For fixed it change in line 1929 this:

for key, value in trigs do

with:

for key, value in pairs(trigs) do

And work
Title: Re: Shuckie Engl-lua 5.lua won't work in ptokax 0.3.5.0 lua 5.1
Post by: TopCat on 17 July, 2006, 15:34:55
Hi Marilyn

Thanks allot  ;D   It's working fine now.  nomore errors  ;)
Title: Re: Shuckie Engl-lua 5.lua won't work in ptokax 0.3.5.0 lua 5.1
Post by: 6Marilyn6Manson6 on 17 July, 2006, 15:48:34
Welcome ;)
Title: Re: Shuckie Engl-lua 5.lua won't work in ptokax 0.3.5.0 lua 5.1
Post by: Markitos on 17 July, 2006, 18:00:31
You will find more error's in table.getn's calls because in lua 5.1 it was renamed to table.maxn + the're missing locals.
This tricker-bot is not the best, search for another maybe clever bot.
Title: Re: Shuckie Engl-lua 5.lua won't work in ptokax 0.3.5.0 lua 5.1
Post by: 6Marilyn6Manson6 on 17 July, 2006, 18:04:42
Quote from: Markitos on 17 July, 2006, 18:00:31
You will find more error's in table.getn's calls because in lua 5.1 it was renamed to table.maxn + the're missing locals.
This tricker-bot is not the best, search for another maybe clever bot.

I have fixed only bug reported by TopCat, I don't have see all code ;)
Title: Re: Shuckie Engl-lua 5.lua won't work in ptokax 0.3.5.0 lua 5.1
Post by: Markitos on 17 July, 2006, 18:14:23
Quote from: 6Marilyn6Manson6 on 17 July, 2006, 18:04:42
Quote from: Markitos on 17 July, 2006, 18:00:31
You will find more error's in table.getn's calls because in lua 5.1 it was renamed to table.maxn + the're missing locals.
This tricker-bot is not the best, search for another maybe clever bot.

I have fixed only bug reported by TopCat, I don't have see all code ;)
I didn't blame you =)
Title: Re: Shuckie Engl-lua 5.lua won't work in ptokax 0.3.5.0 lua 5.1
Post by: 6Marilyn6Manson6 on 17 July, 2006, 18:23:05
Quote from: Markitos on 17 July, 2006, 18:14:23
Quote from: 6Marilyn6Manson6 on 17 July, 2006, 18:04:42
Quote from: Markitos on 17 July, 2006, 18:00:31
You will find more error's in table.getn's calls because in lua 5.1 it was renamed to table.maxn + the're missing locals.
This tricker-bot is not the best, search for another maybe clever bot.

I have fixed only bug reported by TopCat, I don't have see all code ;)
I didn't blame you =)

OK :D
Title: Re: Shuckie Engl-lua 5.lua won't work in ptokax 0.3.5.0 lua 5.1
Post by: bastya_elvtars on 17 July, 2006, 18:54:30
Quote from: Markitos on 17 July, 2006, 18:00:31
You will find more error's in table.getn's calls because in lua 5.1 it was renamed to table.maxn + the're missing locals.
This tricker-bot is not the best, search for another maybe clever bot.

Put in the front:

table.getn=table.getn or function(tbl) return #tbl end
Title: Re: Shuckie Engl-lua 5.lua won't work in ptokax 0.3.5.0 lua 5.1
Post by: Markitos on 17 July, 2006, 19:15:58
Quote from: bastya_elvtars on 17 July, 2006, 18:54:30
Quote from: Markitos on 17 July, 2006, 18:00:31
You will find more error's in table.getn's calls because in lua 5.1 it was renamed to table.maxn + the're missing locals.
This tricker-bot is not the best, search for another maybe clever bot.

Put in the front:

table.getn=table.getn or function(tbl) return #tbl end
Interesting function! Or maybe table.getn = table.getn or table.maxn
Title: Re: Shuckie Engl-lua 5.lua won't work in ptokax 0.3.5.0 lua 5.1
Post by: bastya_elvtars on 17 July, 2006, 20:13:30
maxn should be avoided whenever possible, it traverses the table (similar to a for loop).
Title: Re: Shuckie Engl-lua 5.lua won't work in ptokax 0.3.5.0 lua 5.1
Post by: Markitos on 17 July, 2006, 20:44:18
Quote from: bastya_elvtars on 17 July, 2006, 20:13:30
maxn should be avoided whenever possible, it traverses the table (similar to a for loop).
Humm thanks for the hint.
Title: Re: Shuckie Engl-lua 5.lua won't work in ptokax 0.3.5.0 lua 5.1
Post by: TopCat on 17 July, 2006, 21:45:07
Hi everybody,

Ive only changed what Marilyn told me to change and it works great in my hub. Ive had no more errors. :P

So i don't know about the other errors but if i get any other ones i will replay them here  ;D
Title: Re: Shuckie Engl-lua 5.lua won't work in ptokax 0.3.5.0 lua 5.1
Post by: 6Marilyn6Manson6 on 17 July, 2006, 22:01:11
Quote from: TopCat on 17 July, 2006, 21:45:07
Hi everybody,

Ive only changed what Marilyn told me to change and it works great in my hub. Ive had no more errors. :P

So i don't know about the other errors but if i get any other ones i will replay them here? ;D

LOL :D
Title: Re: Shuckie Engl-lua 5.lua won't work in ptokax 0.3.5.0 lua 5.1
Post by: Markitos on 18 July, 2006, 19:29:25
Quote from: bastya_elvtars on 17 July, 2006, 18:54:30
table.getn=table.getn or function(tbl) return #tbl end
After some reading...
function len_event (op)
       if type(op) == "string" then
         return strlen(op)         -- primitive string length
       elseif type(op) == "table" then
         return #op                -- primitive table length
Title: Re: Shuckie Engl-lua 5.lua won't work in ptokax 0.3.5.0 lua 5.1
Post by: Markitos on 18 July, 2006, 21:21:12
Quote from: Mutor on 18 July, 2006, 20:43:53
Yes that works well, I for one dont mind traversing the table  ;D

table.maxn will serve well for most applications
#tablename will serve as well

btw your example code is LUA 4  and the function, incomplete...


Length = function(item)
if item then
if type(item) == "string" then
return string.len(item)
elseif type(item) == "table" then
return #item
end
end
end

Your right, i though so but wasn't sure. I never programmed in LUA 4 and found that func. in here http://www.lua.org/manual/5.1/manual.html#2.8
I noticed too that it was incomplete but what i wanted to know/show was the lenght operator #.


Cheers