lua-users home
lua-l archive

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


On Wed, Apr 27, 2011 at 10:58, Marc Balmer <marc@msys.ch> 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? ;-)

>> Maybe it is a good idea to emphasize this fact in the manual? Like add
>> a short sentence to the blob of code that now describes the metamethod
>> behaviour.

> The pseudo code in the reference manual describes this very cleary, imo.

I do not argue with that.

>> I would even go further and add a full natural language description to
>> each metamethod. While a blob of code is sufficient, it is too formal
>> for newbie (who is not necessarily verse enough in Lua to get a full
>> grasp of it).

> A blob of code is what programmers should be able to read, imo.

Nevertheless, it is clearly not enough.

Alexander.