restoreproto Synchronous

Undo a hookproto replacement for a specific ProtoProxy. It restores the original nested code for closures that were affected by that hook.

Syntax
Luau
restoreproto(target: ProtoProxy) -> ()

Parameters

Function parameters
ParameterTypeDescription
targetProtoProxyThe hooked ProtoProxy.

Returns

()

No value.

Usage notes

Calling restoreproto on a prototype without an active proto hook raises an error.

Example

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
Kawaii documentation