fn. Where
newcclosure produces something that looks like a C
function, newlclosure produces a genuine Luau closure, so it reports true
from islclosure and carries its own proto.
Parameters
function
required
The function to wrap.
Returns
function
A Luau closure equivalent to
function(...) return fn(...) end, elevated to run
with Athena’s identity.Behavior
The wrapper is compiled from a small forwarding stub and capturesfn as an
upvalue. Because it is a real Luau closure:
- It has a proto, so
getfunctionhashand the bytecodedebugfunctions work on it. - It reports
truefromislclosureandfalsefromiscclosure.
Example
Errors
Related
newcclosure: a C wrapper instead of a Luau one.