lua-users home
lua-l archive

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


--- 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