[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: table.new in 5.3?
- From: Coda Highland <chighland@...>
- Date: Mon, 25 Nov 2013 09:37:07 -0800
On Mon, Nov 25, 2013 at 7:00 AM, Philipp Janda <firstname.lastname@example.org> 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.