lua-users home
lua-l archive

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

On Tue, Sep 10, 2013 at 6:27 PM, David Demelier
<> wrote:
> The second one maybe more performant (I guess, not tested) on huge
> objects. Also the second one may use different function as parameter
> without rewriting the for loop in the first one.

It's a matter of taste, I think.  Lua itself went from the 2nd form
('internal iterators') like table.foreach to the 1st form ('external
iterators').  A little less clunky, and coroutines make the 1st form
possible for even quite awkward operations like traversing a binary

Pick one and use it consistently, that seems to be the main thing ;)