Skip to content
Saiko

newcclosure

Wraps a Luau function so that it reports as a C closure. Used to disguise hooks and to bypass upvalue limits in hookfunction.

Signature

luau
newcclosure<A..., R...>(fn: (A...) -> R...): (A...) -> R...

Parameters

fn(A...) -> R...

The Luau function to wrap.

Returns

function

Example

luau
local wrapped = newcclosure(function(...)
    return ...
end)

print(iscclosure(wrapped)) --> true
print(wrapped("kept")) --> kept