Hi,
I had this function:
local function myfunc(a,b)
-- some code here
x = myfunc(y,z)
-- more code here
return v
end
Then I changed the name of the function:
local function dothing(a,b)
But I forgot to change the body!
To avoid having to change the function body every time (and to be
able to call itself when using local name = function(args)), I
propose an operator or keyword or something that returns the same
value as "debug.getinfo(1,'f').func"...
"What should it be?" good question... I'm not sure... I'd use
"self" but that's reserved by the :func() syntax sugar...
"function.self" seems interesting but weird/'not-lua'...
Wrap the function and let it capture itself as an upvalue. For example;
do local X = function(...) X(...) end someglobal = X end
No need for any syntactic sugar
|