Volt

oth.unhook

Removes a hook created with oth.hook.

Syntax

oth.unhook(target: function) -> boolean

Parameters

ParameterTypeDescription
targetfunctionThe hooked function to remove

Returns

TypeDescription
booleanTrue if the hook was successfully removed

Description

oth.unhook removes a hook from a function that was created with oth.hook. The function is restored to its original behavior.

Example

-- Hook a function
local originalFunc = oth.hook(someCFunction, function(...)
    print("Hooked:", ...)
    return originalFunc(...)
end)

-- Later, remove the hook
local success = oth.unhook(someCFunction)
if success then
    print("Hook removed successfully")
end

Check Hook Status

local originalFunc = oth.hook(print, function(...)
    print("[HOOKED]", ...)
end)

-- Remove hook
if oth.unhook(print) then
    print("Hook removed")
else
    print("No hook to remove")
end

Notes

  • Only works on functions hooked with oth.hook
  • Returns false if the function wasn't hooked or hook removal failed
  • The original function reference from oth.hook remains valid after unhooking

On this page