lua-users home
lua-l archive

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


On Mon, Jun 23, 2008 at 8:58 AM, Ong hean kuan <mysurface@gmail.com> wrote:
> Duncan:
> Although I am not completely clear why ipairs({}), t, -1 works, but I will
> read the iterators chapter again.

iterators return 3 parameters to the "for" statement.  the first one
is a function.  both ipairs() and pairs() have a private function that
they use for that (that is, it isn't a closure created each time).
duncan's ipairs2() simply borrows ipairs()'s stepping function at
startup time.

-- 
Javier