lua-users home
lua-l archive

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

On Mon, Jul 1, 2013 at 12:11 PM, Tim Hill <> 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.

/s/ Adam