[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: [ANN] Lua 5.3.0 (alpha) now available
- From: Coroutines <coroutines@...>
- Date: Fri, 1 Aug 2014 11:34:33 -0700
On Fri, Aug 1, 2014 at 11:10 AM, Coda Highland <chighland@gmail.com> wrote:
> Seriously, though, I can't see any real uses for it beyond just a
> complete and total table wipe. Anything else is either adequately
> served by nil assignment, or is an implementation detail that isn't
> exposed anyway.
>
> /s/ Adam
>
Yeah, just a simple clear() for everything in the table would be nice.
I don't know exactly how the array-part or the hash-part work but
ideally I'd want a tight C loop on both to nil their values and set
the length for either portion -- so the allocated array internally
says the same size, it's just cleared. Same for the hash portion.
I could really only see extra parameters to this function if I wanted
to clear only the array portion, or only the hash portion.
Something like: table.clear(table[, mode]) -- were mode is a string
containing either 'a' for array or 'h' for hash -- similar to __mode's
option list in metatables. Really just a table.clear() for erasing
everything would be nice...