[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: __index and __newindex
- From: Michal Kottman <k0mpjut0r@...>
- Date: Wed, 27 Apr 2011 10:11:48 +0200
On Wed, 2011-04-27 at 11:23 +0400, Alexander Gladysh wrote:
>
> >> I often see that people do miss the fact that __index and
> __newindex
> >> are called for non-existant keys only. When I was a newbie I missed
> >> that too.
>
> > To be correct, this is only the case for tables.
>
> For the tables, that's right. But what is exactly 'non-existant key'
> in userdata? ;-)
I understand it like this: userdata themselves can never have any keys
in sense of Lua tables (they are "untouchable" from Lua), so this means
that the __index and __newindex metamethods are *always* called for
userdata :)