Overview
When the debugger pauses, the Variables panel in the Run & Debug sidebar shows the current values of all accessible variables at the selected stack frame.
Variable scopes
The Variables panel groups values into scopes:
| Scope | Description |
|---|
| Locals | Variables defined in the current function |
| Upvalues | Variables captured from enclosing scopes |
| Globals | The global _G table (expandable) |
Navigating nested values
You can expand tables and objects. Click the arrow next to a table variable to reveal its keys and values. There is no depth limit, so you can drill down as deep as needed.
▼ ent (Entity)
├ EntIndex: 42
├ Class: prop_physics
▼ GetNetworkVars (table)
├ Health: 100
└ Active: true
Editing variable values
When paused, you can modify variable values directly in the Variables panel:
- Click on the value in the Variables panel
- Type the new Lua expression to evaluate as the value
- Press Enter
Changes take effect in the running Lua state.
Editing variables only changes the value in the current Lua execution context. Side effects (like calling setters or updating networked values) require manual code execution.
Watch expressions
Add expressions to the Watch panel to evaluate them every time execution pauses:
- Click the
+ button in the Watch panel
- Enter a Lua expression (e.g.,
ply:Health(), #ents.GetAll())
GLuaLS re-evaluates the expression in the selected stack frame each time execution pauses.
Debug Console
Open the Debug Console (Ctrl+Shift+Y) to evaluate arbitrary Lua expressions:
> ply:Nick()
"PlayerName"
> ents.FindByClass("prop_physics")
{ [1] = (Entity: prop_physics), [2] = (Entity: prop_physics) }
> ply:SetHealth(100)
-- (no output, but health is set)
GLuaLS evaluates expressions in the selected stack frame.
Stop on entry and error
stopOnEntry: pause before any user Lua runs; useful for capturing startup variable state
stopOnError: pause when any error() or uncaught Lua exception occurs; the Variables panel shows state at the moment of the error