Syntax
restorefunction(firstFunction: function, secondFunction?: function)Aliases
restorefuncrestoreclosureArguments
| Name | Type | Description |
|---|---|---|
firstFunction | function | With one argument, the hooked function to restore. With two function arguments, the function to replace. |
secondFunction? | function | Optional closure to patch with firstFunction. This branch is used only when the second argument is a function. |
Description
Restores a hooked function, or replaces one function with another when two function arguments are provided. The first argument must be a function.
Call it with 2 parameter(s): firstFunction, secondFunction. The argument table explains which values are required and which ones only refine the behavior.
It does not return data. Treat the call as an action and handle errors around the call site when needed.
Example
Restore a hooked closure to its original function.
local function target()
return "original"
end
hookfunction(target, function()
return "hooked"
end)
print(target())
restorefunction(target)
print(target())