[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Next Version of Lua?
- From: Luiz Henrique de Figueiredo <lhf@...>
- Date: Wed, 10 Jun 2009 08:59:24 -0300
> I'd vote for a '__iter' metamethod so you could provide a customised
> iterator factory for an object class. This would allow syntax:
> for k,v in obj do ... end
As you have noticed, you can use __call for that:
__call = function (x,y,z) return next(x,z) end
for k,v in t do print(k,v) end
No parentheses needed.