[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: petition to keep ipairs alive
- From: Quae Quack <quae@...>
- Date: Thu, 20 May 2010 11:29:29 +1000
On 20 May 2010 02:59, Norbert Kiesel <email@example.com> wrote:
> Is deprecating ipairs really necessary? I know it can be replaced for
> most parts with a numeric for loop, but these often look and feel
> clumsy. There are a few other "syntactic sugar" constructs in Lua, so
> why is ipairs singled out?
I am very much against leaving ipairs in.
It is slow compared to a numeric for, and rarely required.
It is highly trivial to implement:
function inext ( t , k )
if k == nil then return 1 , t [ 1 ] -- maybe you want to rawget?
elseif type(k) == "number" then return k+1 , t [ k + 1 ]
else error("Bad index to inext")
function ipairs ( t )
(this has been untested)
5.2 breaks alot of compatability, and the removal of ipairs is a great thing.