lua-users home
lua-l archive

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


On Sun, Oct 26, 2014 at 4:06 PM, Tim Hill <drtimhill@gmail.com> wrote:
> At the risk of doing this topic to death…
>
> So now that ipairs() has been reverted to a more 5.2 like behavior, should __ipairs() still be deprecated? When ipairs() was going to just be 1..#t then this metamethod was redundant since the __len metamethod could be used to control the iteration. Now that ipairs() no longer does that, I think the __ipairs() metamethod has some justification to existing again.

I think this entire exercise has shown that it is pointless trying to
accommodate all the desired variations of what ipairs could mean for
an object. I like that Lua 5.3 is choosing a simple definition that
does not rely on any metamethods (even __len). If it doesn't work for
you, *write your own iterator*.

-- 
Patrick Donnelly