[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: new "empty" value/type in Lua?
- From: Coda Highland <chighland@...>
- Date: Mon, 1 Jul 2013 12:13:20 -0700
On Mon, Jul 1, 2013 at 12:11 PM, Tim Hill <email@example.com> wrote:
>>> That could be useful, but also a bit confusing as it means a key set to nil
>>> and a key that was never set (or was deleted) are different things, but both
>>> have a nil value.
>> You can tell the difference with table.has().
> Depending on how # behaved, you might also be able to tell with just (i <=
> #t) ?
table.has() is a generic mechanism for all tables, not just arrays --
a sparse array or a freeform table could still have nil-valued entries
as distinct from nonexistent entries.