lua-users home
lua-l archive

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


On Mon, Nov 25, 2013 at 7:00 AM, Philipp Janda <siffiejoe@gmx.net> wrote:
> Am 25.11.2013 14:54 schröbte Javier Guerra Giraldez:
> So LuaJIT's `table.clear` should work fine for its purpose (although it's
> basically an alias for `for k in pairs( t ) do t[ k ] = nil end` anyway).
> The proposed Lua `table.clear` (or `table.wipe`) would be a way to actually
> release the memory owned by a clear table, but what I think would be needed
> more is a `table.fit` function that makes array and hash part exactly as
> large as needed for the values currently in the table.

I would recommend "table.compact" for that behavior, as the concept of
compacting free space is well-known.

/s/ Adam