Skip to content
Functions & closuresReferenceNew · 0.744

restoreproto

Describe restoration in the prototype-oriented interception API.

Details#

Restores the supplied function using the same restoration mechanism as restorefunction. Use the exact closure passed to hookproto. This is not an operation on a numeric prototype index.

Signature#

Luau
restoreproto(target: function): boolean

Parameters#

ParameterTypeDescription
targetfunctionThe exact function value to inspect or modify.

Returns#

true if a hook was removed, otherwise false.

Examples#

Example

Luau
local function answer() return 42 end
hookproto(answer, function() return 0 end)
print(restoreproto(answer)) -- true
print(answer()) -- 42