Closures
checkcaller
Returns whether the function currently running was called by the executor.
This is useful for metamethod hooks that behave differently when called by the game.
clonefunction
Generates a new closure based on the bytecode of function func
.
getcallingscript
Returns the script responsible for the currently running function.
hookfunction
Replaces func
with hook
internally, where hook
will be invoked in place of func
when called.
Returns a new function that can be used to access the original definition of func
.
If func
is a Luau function (islclosure(func) --> true
), the upvalue count of hook
must be less than or equal to that of func
. Lua visibility rules
iscclosure
Returns whether or not func
is a closure whose source is written in C.
islclosure
Returns whether or not func
is a closure whose source is written in Luau.
isexecutorclosure
Returns whether or not func
was created by the executor.
loadstring
Generates a chunk from the given source code. The environment of the returned function is the global environment.
If there are no compilation errors, the chunk is returned by itself; otherwise, it returns nil
plus the error message.
chunkname
is used as the chunk name for error messages and debug information.
newcclosure
Returns a C closure that wraps func
. The result is functionally identical to func
, but identifies as a C closure.
Last updated