lua-users home
lua-l archive

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





On Mon, Jun 9, 2014 at 9:25 PM, Thiago L. <fakedme@gmail.com> 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()?



In 5.2, __len and __ipairs made that a easy answer: you can override them independently. In 5.1, someone else might have a better answer than i.