lua-users home
lua-l archive

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


2018-03-24 9:18 GMT+02:00 Sergey Zakharchenko <doublef.mobile@gmail.com>:

>> You can't change the way '__pairs' is called without changing 'pairs'
>> itself. The manual states: "pairs (t) ... If t has a metamethod
>> __pairs, calls it with t as argument." I see no way of implementing
>> your proposal that will not involve a change to "pairs (t[,opt]) ...
>> If t has a metamethod __pairs, calls it with t and opt as arguments."
>
> Does pairs() have exclusive rights on calling __pairs()? (Obviously no).

Should we extend that logic to __len, __add, __concat etc, or is there
something special about __pairs?