Table.getn() fails...

Discuss using and improving Lua and the Lua Player specific to the PSP.

Moderators: Shine, Insert_witty_name

Post Reply
LuMo
Posts: 410
Joined: Sun Aug 21, 2005 2:45 am
Location: Austria
Contact:

Table.getn() fails...

Post by LuMo »

hey guys!
got the following keyed table...

Code: Select all

Startpos = {
p1={x=1,y=2},
p2={x=3,y=4}
}
further it try to get the data from it

Code: Select all

print(Startpos.p1.x) --ok
print(Startpos.p1.y) --ok
print(Startpos.p2.x) --ok
print(Startpos.p2.y) --ok
which works just fine...

Code: Select all

print('players: '..table.getn(Startpos))
but getting its size fucks up, says 0 but its definitive 2 ;)

greets
lumo
"Good artists copy, great artists steal."
Pablo Picasso
go2lumo.com
KawaGeo
Posts: 191
Joined: Sat Aug 27, 2005 6:52 am
Location: Calif Mountains

Post by KawaGeo »

The answer is correct, indeed!

Named indices are not counted.

Have you read PIL, my friend? :)
Geo Massar
Retired Engineer
LuMo
Posts: 410
Joined: Sun Aug 21, 2005 2:45 am
Location: Austria
Contact:

Post by LuMo »

hehe nope, not for that;
thanks
"Good artists copy, great artists steal."
Pablo Picasso
go2lumo.com
Post Reply