restorefunction
This will throw an error if the requested function is not already hooked
restorefunction restores a hooked function back to the very first original function, even if it has been hooked multiple times.
function restorefunction(functionToRestore: (...any) -> (...any)): ()
Parameters
| Parameter |
Description |
functionToRestore |
The hooked function that you want to restore |
Examples
Example 1
| Restoring a hooked function |
|---|
| function dummy_func()
print("I am not hooked!")
end
hookfunction(dummy_func, function()
print("I am hooked!")
end)
dummy_func() -- Output: I am hooked!
restorefunction(dummy_func)
dummy_func() -- Output: I am not hooked!
|
Example 2
| Restoring a function that was never hooked |
|---|
| function dummy_func()
print("I am not hooked!")
end
dummy_func() -- Output: I am not hooked!
restorefunction(dummy_func) -- Error: restorefunction: function is not hooked
|