lua-users home
lua-l archive

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

On Wed, Dec 16, 2009 at 11:57 PM, Geoff Leyland
<> wrote:
> for v in elements(obj) do ... end
> really too ugly?

To me, it's consistent with pairs/ipairs, which will apparently
respect the __pairs,__ipairs metamethod.

So maybe call it iter(), and make it understand __iter.  Not
complicated, as you say, and quite efficient to do in Lua.

One of the reasons that there's so much pressure for features to go in
the core is the the lack of standard libraries.  So I may use iter()
as a global but without community consensus it's a personal
convenience, nothing more.  Personally I prefer using a iter() method,
avoiding a global.

steve d.