Read a closure's upvalues (captured variables)
get-closure-upvaluesResolve a Luau expression to a function and dump its upvalues to inspect captured variables and hidden closure state for reverse-engineering.
Instructions
Resolve a Luau expression to a function and dump its upvalues via getupvalues. Upvalues are the variables a closure captured from its enclosing scope — the live state a function carries with it (config tables, cached remotes, counters, references to other functions, flags). Inspecting them reveals hidden state that source code alone does not show, which is invaluable when reverse-engineering a handler or locating a kill-switch/flag to flip. This is the by-reference companion to find-upvalue-xref. Each entry reports its 1-based Index, Luau Type, and an encoded Value; the same Index is what set-closure-upvalue mutates. Requires the executor's getupvalues (debug.getupvalues); if unavailable a clean { error } is returned. Returns { Target, Info, Upvalues:[{Index,Type,Value}], Count } or { error }. Signature: { functionPath: string, threadContext: number? }. Phase: observe; cost=medium; idempotency=read-only. Requires: active-client, resolved-target. Capabilities: debug closure primitives. 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 |
|---|---|---|---|
| functionPath | Yes | Luau expression resolving to a function whose upvalues you want, e.g. 'getsenv(game.Players.LocalPlayer.PlayerScripts.Main).step', 'getrawmetatable(game).__index', or 'getconnections(workspace.Part.Touched)[1].Function'. Evaluated as `return <functionPath>`. Captured variables are editable by Index via set-closure-upvalue. | |
| threadContext | No | Optional Roblox thread identity for this call; omit it to use the server default. |