[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: RE: '__iter', yet again!
- From: "John Hind" <john.hind@...>
- Date: Thu, 17 Dec 2009 09:53:06 -0000
I agree - the dual nature of the table type precludes setting a metatable by
default (like was recently done for string). Some layer on top of base Lua
has to decide if a particular table should use pairs, ipairs or something
else (and attach the appropriate metatable).
> -----Original Message-----
> From: firstname.lastname@example.org [mailto:lua-
> email@example.com] On Behalf Of Alexander Gladysh
> Sent: 16 December 2009 22:04
> To: Lua list
> Subject: Re: '__iter', yet again!
> On Thu, Dec 17, 2009 at 00:29, John Hind <firstname.lastname@example.org> wrote:
> > '__iter' is intended to enable you to write:
> > for v in obj do ... end
> Oh. I hope, if such feature would be implemented, default __iter would
> not be set for any Lua type.
> Another option I can live with, is to make third kind of for loop for
> I prefer to be explicit in my loops.