[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Weird __newindex behaviour
- From: Javier Guerra Giraldez <javier@...>
- Date: Tue, 22 Sep 2015 10:50:30 -0500
On Tue, Sep 22, 2015 at 10:41 AM, Scott Morgan <blumf@blueyonder.co.uk> wrote:
> Why isn't the first `tab.test = nil` event being handled by the
> metatable?
__newindex is a fallback, not an override. that means that it's only
called when the table doesn't have that index already. that is, when
it's a new index.
if you want to get all settings, you do a "proxy table", i.e. don't
store in the object table itself, but on an different, internal table.
--
Javier