|
> variable to hold the parent function seems very ugly to me.
You could get fancy (or scary, depending upon your viewpoint):
_function_mt =
{
__concat = function(f1,f2)
return function(...)
return f2(f1(...))
end
end
}
debug.setmetatable(debug.getmetatable(print),_function_ mt)
dosomething = module1.dosomething .. module2.dosomething
print = function(...)
log('debug',"calling print")
return ...
end
.. print ..
function(...)
log('debug',"done calling print")
return ...
end
-spc (Betcha didn't know you could concat functions?)