debug.getconstants
C closures are not supported
This function will throw an error if called on a C closure, such as print
, since C closures have no accessible constants.
debug.getconstants
returns a list of all constants used within a Luau function's bytecode. This includes literal values like numbers, strings, booleans, and nil
.
function debug.getconstants(func: (...any) -> (...any) | number): { number | string | boolean | nil }
Parameters
Parameter | Description |
---|---|
func |
The Lua function (or stack level) whose constants will be returned. |
Examples
Example 1
Example 2
Calling on a C closure should error | |
---|---|