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