Yuari
Documentation
Docs/Closures/restorefunction

restorefunction

Restores a function replaced by hookfunction.

Syntax

restorefunction(fn: function) -> nil

Parameters

ParameterTypeDescription
fnfunctionThe function or callback to use.

Returns

TypeDescription
nilThis function does not return a value.

Description

restorefunction is part of the Closures library. Closure helpers operate on live Luau function objects. Hooks redirect future calls through the replacement closure and return the previous implementation.

The previous hook is removed and future calls are routed back to the original implementation.

The aliases restorefunc(fn) resolve to the same implementation.

Example

local original = hookfunction(print, function() end)
restorefunction(print)
print("print restored", original)

Notes

  • Aliases: restorefunc(fn).
  • Closure operations act on live Luau function objects; installed hooks remain active until restored.