Atomic docs

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

lua
local old
old = hookfunction(print, function(...)
    return old("intercepted:", ...)
end)
↑