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#
restoreproto(target: function): booleanParameters#
| Parameter | Type | Description |
|---|---|---|
target | function | The exact function value to inspect or modify. |
Returns#
true if a hook was removed, otherwise false.
Examples#
Example
local function answer() return 42 end
hookproto(answer, function() return 0 end)
print(restoreproto(answer)) -- true
print(answer()) -- 42