lua-users home
lua-l archive

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


On 21 April 2012 01:28, Rob Hoelz <rob@hoelz.ro> wrote:
> I'm having trouble parsing what you want to do.  Do you want to do
> something like this:
>
>  for x in object:method() do
>    ...
>  end
>
> -Rob
>
> On Fri, Apr 20, 2012 at 05:17:45PM +0200, Dirk Laurie wrote:
>> I can't say:
>>   for x in f = object:method do
>>
>> Instead, I must say
>>   for f in function(...) return object:method(...) end do
>>
>> The error seems to be at syntax level:
>>
>> stdin:1: function arguments expected near 'do'
>>
>> Is there some philosophical reason why this sugar is not available?
>>
>

I believe he brings up the possible sugar of tbl:method returning a closure

It has been discussed before; see:

http://lua-users.org/lists/lua-l/2010-01/msg00961.html
http://lua-users.org/lists/lua-l/2009-09/msg00382.html