hookfunction
Hooks a function with another wanted function, returning the original unhooked function.
function hookfunction<A1..., R1..., A2..., R2...>(function_to_hook: (A1...) -> R1..., function_hook: (A2...) -> R2...): (A1...) -> R1...
Parameters
function_to_hook
- The function that will be hookedfunction_hook
- The function that will be used as a hook
Example
local function DummyFunction()
print("I am not hooked!")
end
local function DummyHook()
print("I am hooked!")
end
DummyFunction() -- Output: I am not hooked!
local OldFunction = hookfunction(DummyFunction, DummyHook)
DummyFunction() -- Output: I am hooked!
OldFunction() -- Output: I am not hooked!
Last updated