Writes a value into a single local slot of a live stack frame on the current thread.
New to stack levels? Learn more here.
Most commonly used from a hook running inside a game script’s thread, to flip one of that script’s locals or rewrite a return slot before the frame returns.
value has to match the type already in the slot. There is no coercion.
The call only reaches frames on the thread it runs on. The target script also has to be running, or the access fails.
Parameters
Returns
void - the slot is overwritten in place.
Aliases
Example
A local starts false in one frame. A deeper call overwrites that frame’s first slot, so the frame returns true instead.
Read the slot with debug.getstack first - it confirms the index and the current type, so the write does not trip the type check.