Shuckie Engl-lua 5.lua won't work in ptokax 0.3.5.0 lua 5.1
 

Shuckie Engl-lua 5.lua won't work in ptokax 0.3.5.0 lua 5.1

Started by TopCat, 17 July, 2006, 13:35:28

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

TopCat

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? ;)

???? TOPCAT'S HOUSE ????

topcat.no-ip.biz:411

6Marilyn6Manson6

#1
For fixed it change in line 1929 this:

for key, value in trigs do


with:

for key, value in pairs(trigs) do


And work

TopCat

Hi Marilyn

Thanks allot  ;D   It's working fine now.  nomore errors  ;)
???? TOPCAT'S HOUSE ????

topcat.no-ip.biz:411

6Marilyn6Manson6


Markitos

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.

6Marilyn6Manson6

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 ;)

Markitos

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 =)

6Marilyn6Manson6

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

bastya_elvtars

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
Everything could have been anything else and it would have just as much meaning.

Markitos

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

bastya_elvtars

maxn should be avoided whenever possible, it traverses the table (similar to a for loop).
Everything could have been anything else and it would have just as much meaning.

Markitos

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.

TopCat

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
???? TOPCAT'S HOUSE ????

topcat.no-ip.biz:411

6Marilyn6Manson6

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

Markitos

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

Markitos

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

SMF spam blocked by CleanTalk