lua-users home
lua-l archive

Re: ipairs in Lua 5.3.0-alpha

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


Le 02/08/2014 09:16, Dirk Laurie a écrit :
This subject is too important to be buried in the big thread.
The idiom
 for k,v in ipairs(tbl) do
appears in numerous programs, very few of which are paranoid
enough to test (redundantly, up to now) that v is not nil. f you
explicitly supply __ipairs, you take responsibility, fair enough.
Now __ipairs is deprecated (although still recognized with default
compatibility options) and that idiom is equivalent to
Mmm, how can you use ipairs on a userdata if the metamethod __ipairs is removed ? Do you need to implement an __index function which verify if the index value is an integer?
Regards,
David.

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