[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: [ANN] Lua 5.2.0 (alpha) now available
- From: Dirk Laurie <dpl@...>
- Date: Mon, 13 Dec 2010 00:11:53 +0200
On Sun, Dec 12, 2010 at 09:57:12PM +0200, Romulo wrote:
> Array with holes are not arrays in Lua, they are hash tables. That simple.
>
> Thus, if t[ 1 ] is nil, then #t is zero, even if different
> implementations may give other results. Specially if others
> implementations give different results.
>
> I wonder why people can't just accept it.
>
Maybe because some of them read the C API section of the Reference Manual,
which says:
--[[
void lua_createtable (lua_State *L, int narr, int nrec);
Creates a new empty table and pushes it onto the stack. The new table has
space pre-allocated for narr array elements and nrec non-array elements.
This pre-allocation is useful when you know exactly how many elements the
table will have. Otherwise you can use the function lua_newtable.
--]]
Dirk