[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: lua4.1w4 - for loop with functions - suggestions
- From: "nikdo79" <dominik-wagner@...>
- Date: Tue, 26 Mar 2002 10:39:04 -0000
--- In lua-l@y..., Eric Tetz <erictetz@y...> wrote:
> --- nikdo79 <dominik-wagner@g...> wrote:
> >yes i know, that the following is possible
> >
> > for a,b in function () return MyObject:Get() end do
> > ....
> > end
> >
> > but i don't like, i think its too clumsy
>
> You can do something like this to clean it up a bit:
>
> function MyObject:iterator()
> return function() return self:Get() end
> end
>
> ...
>
> for a,b in MyObject:iterator() do
> ...
> end
I've seen this too, but i still think it's messy.
Thanks,
Dom