[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: There's gotta be a more "Lua" way to do this
- From: "Ashwin Hirschi" <deery@...>
- Date: Thu, 3 Jul 2003 05:15:23 +0200
>> What's the more "Lua" way to generically create a closure for a given
>> function and its arbitrary arg list than the following:
> [snip<]
>
> How about something like:
>
> function closure(func, ...)
> return function() call(func, arg) end
> end
>
> for Lua 4
Boy, I'm really at it: I forgot the upvalues as well as the return. Then
again, it's way past midnight here in the lowlands. So people should
probably bear with me... [;-)]
Anyways, my proposal for Lua 4 should have read:
function closure(func, ...)
return function() return call(%func, %arg) end
end
Ashwin.