hookfunction
hookfunction(target: function, hook: function): function
Replaces target with hook and returns the original, so the hook can still call through. Aliased as hookfunc and replaceclosure.
Example
local old
old = hookfunction(print, function(...)
return old("intercepted:", ...)
end)