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]


2014年08月16日 16:23 GMT+02:00 Andrew Starks <andrew.starks@trms.com>:
> What would be most useful to me, would be if ipairs returned all numeric key
> / value pairs, in order, regardless of holes.
I can't see how implementing that in C would be possible in
a cleverer way than iterating over pairs and keeping what you
need. But the Lua extension I thought was off-topic would
do this for you:
 for k,v in pairs(tbl) if type(k)=='number' do
 ...
 end

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