lua-users home
lua-l archive

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


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