[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: table.getn in Lua 5.0.2/3
- From: roberto@... (Roberto Ierusalimschy)
- Date: Thu, 14 Sep 2006 07:58:28 -0300
> It seems to not behave in accordance with the Lua 5.0 docs:
>
> t = {}
> table.insert(t, "a")
> t[1] = nil
> print (table.getn(t))
>
> > 1
>From the docs:
table.insert (table, [pos,] value)
Inserts element value at position pos in table, [...]
This function also updates the size of the table by
calling table.setn(table, n+1).
table.getn (table)
Returns the size of a table, when seen as a list. [...]
if there was a previous call to table.setn over this table,
the respective value is returned.
-- Roberto