Volt

oth.get_root_callback

Returns the original function, even after multiple hooks.

Syntax

oth.get_root_callback(target: function) -> function?

Parameters

ParameterTypeDescription
targetfunctionThe hooked function

Returns

TypeDescription
function?The original function, or nil if not found

Description

oth.get_root_callback returns the original function that was hooked, even if multiple hooks have been applied. This allows you to bypass all hooks and call the true original function.

Example

-- Hook a function multiple times
local hook1 = oth.hook(someCFunction, function(...)
    print("Hook 1")
    return hook1(...)
end)

local hook2 = oth.hook(someCFunction, function(...)
    print("Hook 2")
    return hook2(...)
end)

-- Get the original, bypassing all hooks
local original = oth.get_root_callback(someCFunction)
original("test") -- Calls the true original, bypassing both hooks

Bypass All Hooks

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

-- Get original to bypass hook
local original = oth.get_root_callback(print)
if original then
    original("Direct call") -- Bypasses the hook
end

Notes

  • Returns nil if the function was never hooked or is not a C function
  • Always returns the true original, regardless of how many hooks exist
  • Useful for completely bypassing all hook layers

On this page