lua-users home
lua-l archive

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


On Mon, Aug 29, 2011 at 06:54:48AM +0200, Josh Simmons wrote:
> 
> __newindex is an odd wording though I'm not sure it'd be really worth
> changing at this point.
> 

On the contrary, it is a perfect name. 

It is the name of a routine that is only invoked if you assign 
something to tbl[idx] when idx is not an existing index into the 
table; that is to say, when idx is a new index.

Since most of the confusion arises because folk think it is invoked 
for *every* assigment into a table, it is a much more suitable name 
than e.g. __assign or __setindex would have been.

Dirk