[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: lua4.1w4 - for loop with functions - suggestions
- From: Eric Tetz <erictetz@...>
- Date: Mon, 25 Mar 2002 16:12:00 -0800 (PST)
--- nikdo79 <dominik-wagner@gmx.net> 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
Cheers,
Eric
__________________________________________________
Do You Yahoo!?
Yahoo! Movies - coverage of the 74th Academy Awards®
http://movies.yahoo.com/