Re: Some conservative Lua metamethod extension proposals
[
Date Prev][
Date Next][
Thread Prev][
Thread Next]
[
Date Index]
[
Thread Index]
- Subject: Re: Some conservative Lua metamethod extension proposals
- From: Dirk Laurie <dirk.laurie@...>
- Date: 2018年3月24日 10:35:19 +0200
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?