value into register index of the frame at level.
Every function on this page is reachable both as
debug.<name> and as a
plain global of the same name, so debug.getupvalues(f) and getupvalues(f)
are the same call.Parameters
thread
The thread to write. Defaults to the current one.
number
required
The stack level.
1 is your caller.number
required
The register to write, from
1.any
required
The value to store.
Behavior
- This changes a running function’s state. Writing a register that the
compiler believed held a different type can crash the frame when it resumes.
Read it with
getstackfirst and match what is there. - Only Luau frames can be written. A C frame raises.
Example
Errors
Related
getstack: read first.