[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: [Proposal] Syntax sugar/operator/keyword for "debug.getinfo(1, 'f').func()" (or just debug.getinfo(1, 'f').func)
- From: Tim Hill <drtimhill@...>
- Date: Thu, 27 Nov 2014 07:52:24 -0800
>>
>> Wrap the function and let it capture itself as an upvalue. For example;
>>
>> do
>> local X = function(...)
> doesn't work
>> X(...)
>> end
>> someglobal = X
>> end
>>
>> No need for any syntactic sugar
>>
>
I meant this of course…
do
local function X(i)
if i == 1 then return 1 end
return X(i - 1) * i
end
fact = X
end
print(fact(3))
—Tim