[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Speaking of tables [Was: Re: python like syntax for lua]
- From: RLake@...
- Date: Fri, 13 Jun 2003 18:32:05 -0500
> Not quite exactly, but very close. Note that 'n' takes precedence over
> setn.
True.
setn will never create an "n" field which doesn't exist. getn and setn
both use an "n" field if it exists; otherwise they use the weak table.
However, varargs still set the "n" field, which is how you can end
up with one.
$ lua
Lua 5.0 Copyright (C) 1994-2003 Tecgraf, PUC-Rio
> t = { 11,22,33 }
> table.setn(t, 3)
> = table.getn(t)
3
> t.n = 2
> = table.getn(t)
2
>