lua-users home
lua-l archive

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


Wim is quite right: I blew it. His works and mine doesn't.

However, I don't think that voids the issue about "next is a more basic
operation than pairs". Of course, it is. The issue is that it is difficult
to write a general "next" routine which doesn't retain state. If you think
about the (proposed or user-implemented) __pairs metamethod as a "next
factory", it probably makes more sense. One of the options of the factory
is to simply return the fixed "next" for that type of object, perhaps by
looking it up in the metatable; but a more general solution is to produce a
"next" on the fly by binding a function with a state.

Rici