lua-users home
lua-l archive

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

On 6/9/14, 7:25 PM, Thiago L. wrote:
Last I checked, `for x,y in ipairs(t) do` is slower than `for x=1,#t do local y = t[x]`, so why do we have ipairs()?

We didn't always have #t, also they have different behaviors in the presence of both holes and arrays which change during iteration (and theoretically for very large tables with only a tiny array part, #t might not be faster).