Skip to content

restorefunction

This will throw an error if the requested function is not already hooked

restorefunction restores a hooked function back to its unhooked state.

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 unhooked function
1
2
3
4
5
6
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