Note that I'm not the king of generic for iteration, and if this
appears to
change the semantics of generic for iterators, that is unintentional.
The
goal was to show the logic flow for selecting an iterator with
metamethods.
(It also assumes generic_for_iterate only proceeds after the code
inside the
loop has been evaluated, of course.)
[1] http://lua-users.org/lists/lua-l/2010-05/msg00581.html
Correct me if I'm wrong - I'm having just a little trouble following
the code - but is this executed for every iteration? I posted an
example a few minutes ago that translates to the current definitions
of the generic and numeric for - so it's really a mapping from pure
syntax to one of the two for's - but I'm not sure where this one fits.