lua-users home
lua-l archive

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


On Wed, Apr 27, 2011 at 12:11, Michal Kottman <k0mpjut0r@gmail.com> wrote:
> 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 :)

Yep. That was a rhetoric question.

Alexander.