You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have recently ran in to some cases where it might seem useful to be able to pre-allocate not just the array part of a table using table.create, but also pre-allocating the hash part to a known or desired size.
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.
Could an additional, perhaps optional, parameter be added to table.create to expose this functionality?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I have recently ran in to some cases where it might seem useful to be able to pre-allocate not just the array part of a table using table.create, but also pre-allocating the hash part to a known or desired size.
when doing my research I found that Lua 5.1"s lua_createtable achieves this exact functionality:
https://www.lua.org/manual/5.1/manual.html
Could an additional, perhaps optional, parameter be added to table.create to expose this functionality?
Beta Was this translation helpful? Give feedback.
All reactions