lua-users home
lua-l archive

Re: __ipairs (was: Re: Lua 5.4 Tuples FTW!)

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


>>>> for i,v in pairs(t) do print(i,v) end
>>A perfect example of why deprecating __ipairs was the wrong move. It
>>ought to be possible to make this code work with ipairs(t) as well, but
>>with no __ipairs metamethod it can't be done.
>>Andrew.
Except of course by the simple expedient of replacing ipairs(t) with a version that does what you want it to do directly! Even, if you insist, with a version that uses a metamethod __ipairs! The metamethods on both pairs and ipairs have
always baffled me with their utter triviality!
- John.

AltStyle によって変換されたページ (->オリジナル) /