debug.getstack — read live Luau stack slots at a level
get-stackRead raw Luau stack values at a given call level to inspect in-flight locals and temporaries, aiding debugging of running functions.
Instructions
Read the raw values currently sitting on the Luau stack at a given call level via the executor's debug.getstack. Without 'index' it returns every live stack slot at that level as an encoded list (Instances/EnumItems/tables are flattened to a JSON-friendly shape); with 'index' it returns just that one slot's encoded value. This exposes the in-flight locals and temporaries of a running function — the values a frame is actively working with — letting you snapshot what a callback or hooked function holds at the moment your code runs. Requires debug.getstack — type-guarded and pcall-wrapped, returning { error } when missing or on failure. Returns { level, index?, value } / { level, count, values } or { error }. Signature: { level: number, index: number?, threadContext: number?, timeoutMs: number? }. Phase: observe; cost=medium; idempotency=read-only. Requires: active-client. Produces: structured-observation. Safety: read-only. On failure: inspect tool-schema for exact fields, defaults, constraints, and an invocation example.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| index | No | Optional 1-based stack slot index. When given, only that single slot is read and returned; when omitted, the whole stack table at 'level' is returned. | |
| level | Yes | The call-stack level to read (1 = the function calling getstack, i.e. the executing chunk; higher = further up the stack). | |
| timeoutMs | No | Optional per-call deadline in milliseconds; omit it to use the tool or server default. | |
| threadContext | No | Optional Roblox thread identity for this call; omit it to use the server default. |