restoreproto Synchronous
Undo a hookproto replacement for a specific ProtoProxy. It restores the original nested code for closures that were affected by that hook.
Luau
restoreproto(target: ProtoProxy) -> ()Parameters
| Parameter | Type | Description |
|---|---|---|
target | ProtoProxy | The hooked ProtoProxy. |
Returns
()No value.
Usage notes
Calling restoreproto on a prototype without an active proto hook raises an error.
Example
Luau
local function factory() return function() return 1 end end
local proto = debug.getproto(factory, 1)
hookproto(proto, function() return 2 end)
restoreproto(proto)
print(factory()()) -- 1