debug.setupvalue
C closures not supported
This function will throw an error if called on a C closure, such as print
, for security reasons.
debug.setupvalue
replaces an upvalue at the specified index in a Luau function, with a new value.
This allows for controlled modification of function state, often used in hooking or testing environments.
Parameters
Parameter | Description |
---|---|
func |
The function (or stack level) whose upvalue to replace. |
index |
The index of the upvalue to be replaced. |
value |
The new value to assign to the upvalue. |