restorefunction

Removes an active function hook.

Syntax

Signature
restorefunction(Target: function) -> ()

Aliases

  • restorefunc

Parameters

ParameterTypeDescription
TargetfunctionFunction previously passed as the target of hookfunction.

Returns

TypeDescription
()None.

Notes

Raises an error if Target has no active hook in this VM.

Example

Luau
local Function = function() return 1 end
hookfunction(Function, function() return 2 end)
restorefunction(Function)
assert(Function() == 1)