lua-users home
lua-l archive

Re: Weird __newindex behaviour

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


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

AltStyle によって変換されたページ (->オリジナル) /