AcediaDocumentation

restorefunction

Restores a function or registered metamethod hook.

The alias restorefunctions still takes one function, not an array.

restorefunction(target: function): ()

Parameters

ParameterTypeDescription
targetfunctionHooked function to restore.

Example

local function target() return "original" end
hookfunction(target, function() return "replacement" end)
restorefunction(target)
print(target())

Example output

original

If no hook is recorded for target — because it was never hooked, or was already restored, or a mutual hook cycle collapsed back to the original — the call is a no-op and does not raise. restorefunction is therefore safe to call repeatedly.

Aliases: restorefunctions, restorefunc.

On this page