lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


2009/7/25 David Manura <dm.lua@math2.org>:
> As previously discussed [1,2], Lua code does not have a direct manner
> of preallocating space in tables, like in the lua_createtable [3] C
> API function.  The problem and its solutions, including a new solution
> involving Lua bytecode hacking, are now described in
>
>  http://lua-users.org/wiki/TablePreallocation
>
> [1] http://lua-users.org/lists/lua-l/2009-06/msg00438.html
> [2] http://lua-users.org/lists/lua-l/2009-04/msg00425.html
> [3] http://www.lua.org/manual/5.1/manual.html#lua_createtable

I thought the normal way to do that from Lua was to put nil in a table
constructor (ie. local t = {nil,nil,nil,nil,nil} would be equivalent
to lua_createtable(L, 5, 0)), but that's not mentionned on your page.
I was certain that lhf posted several times about that pseudo-feature,
but now I can't find any of these threads in the mailing list archive,
so I may be wrong.