[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: ipairs in Lua 5.3.0-alpha
- From: Dirk Laurie <dirk.laurie@...>
- Date: Sat, 16 Aug 2014 16:32:21 +0200
2014-08-16 15:37 GMT+02:00 Andrew Starks <andrew.starks@trms.com>:
> The ability to directly overload the standard iterator that returns numeric
> keys in order will be missed, but only a little. It's only a little odd to
> ask a user to use pairs in that case and I can always write a custom
> iterator.
I'm already at the point where I always use next,tbl and never
pairs(tbl). It will be only a small step from there to always using
inext,tbl and never ipairs,tbl:
function inext(tbl,k)
k=(k or 0)+1
local v=tbl[k]
if v then return k,v end
end
It would be nice if standard Lua offered this inext built-in, but the
beauty of Lua is that all of the standard library is easily customizable.
- References:
- Speed of # operator (Was: ipairs in Lua 5.3.0-alpha), Dirk Laurie
- Re: Speed of # operator (Was: ipairs in Lua 5.3.0-alpha), Enrico Colombini
- Re: Speed of # operator (Was: ipairs in Lua 5.3.0-alpha), Jan Behrens
- Re: Speed of # operator (Was: ipairs in Lua 5.3.0-alpha), Roberto Ierusalimschy
- Re: ipairs in Lua 5.3.0-alpha, Jan Behrens
- Re: ipairs in Lua 5.3.0-alpha, Jan Behrens
- Re: ipairs in Lua 5.3.0-alpha, Roberto Ierusalimschy
- Re: ipairs in Lua 5.3.0-alpha, Jan Behrens
- Re: ipairs in Lua 5.3.0-alpha, Jan Behrens
- Re: ipairs in Lua 5.3.0-alpha, Roberto Ierusalimschy
- Re: ipairs in Lua 5.3.0-alpha, Jan Behrens
- Re: ipairs in Lua 5.3.0-alpha, Doug Currie
- Re: ipairs in Lua 5.3.0-alpha, Coda Highland
- Re: ipairs in Lua 5.3.0-alpha, Jan Behrens
- Re: ipairs in Lua 5.3.0-alpha, Andrew Starks