[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: tables holding nil
- From: Cosmin Apreutesei <cosmin.apreutesei@...>
- Date: Wed, 22 Jul 2009 23:34:54 +0300
>> Just found out that the __index metamethod is called for x=a[nil], but
>> __newindex is not called for a[nil]=x -- instead the operation is
>> specifically forbidden. I'd rather have it called too and not throw an
>> error. What am I missing?
>
> nil is not a valid table key. That's all!
Then shouldn't access to a[nil] be forbidden too? Not that I'd like it
any better. What's the logic behind this limitation though?