lua-users home
lua-l archive

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


On Wed, Jul 22, 2009 at 9:36 PM, Peter Cawley<lua@corsix.org> wrote:
> On Wed, Jul 22, 2009 at 9:30 PM, Jim Whitehead II<jnwhiteh@gmail.com> wrote:
>> nil is not a valid table key.  That's all!
>>
>
> Indeed, nil is not a valid table key, but metatables are intended for
> non-standard cases, so allowing __newindex to handle the case of key
> == nil would seem to be within the Lua philosophy. The manual's
> psuedo-code for __newindex would also not give the impression of nil
> being filtered out.

Completely right, forgive my hasty response.  I actually misread the
OP and misunderstood what was being asked.  It is pretty interesting
that access tbl[nil] is allowed, while setting it is not.