Skip to main content

Setting breakpoints

Click in the gutter (left margin) of any .lua file to set a breakpoint. A red dot appears where execution will pause. You can also set breakpoints from the Run & Debug panel’s Breakpoints section.

Conditional breakpoints

Right-click in the gutter (or on an existing breakpoint) and choose Edit Breakpoint to add a condition:
-- Only break when this is true:
ply:Health() < 10
The debugger evaluates the condition as a Lua expression in the paused stack frame. Execution pauses only when the expression returns a truthy value.

Logpoints

A logpoint prints a message to the Debug Console when execution reaches that line. Right-click in the gutter and choose Add Logpoint:
Player {ply:Nick()} took damage: {dmg:GetDamage()}
Curly braces {} evaluate Lua expressions.

Stepping controls

When execution is paused at a breakpoint, use the debug toolbar or keyboard shortcuts:
ActionShortcutDescription
ContinueF5Resume execution until the next breakpoint
Step OverF10Execute the current line and pause on the next
Step IntoF11Step into the function call on the current line
Step OutShift+F11Continue until the current function returns, then pause
PauseF6Pause execution at the current Lua instruction
StopShift+F5Disconnect the debugger

Call stack

When paused, the Call Stack panel shows the full active call stack from the current Lua execution context. Each frame shows:
  • The function name (or (anonymous) for unnamed functions)
  • The source file and line number
Click any frame to navigate to that file and inspect the variables at that level.

Stop on entry

Set "stopOnEntry": true in launch.json (default: true) to pause at the first Lua instruction after connecting. Useful when debugging server startup behavior.

Stop on error

Set "stopOnError": true in launch.json to pause when a Lua error is thrown anywhere on the server, including unhandled errors in hook callbacks. GLuaLS preserves the call stack at the moment of the error so you can inspect the full execution context.

Break here (manual pause)

To pause at an arbitrary point without a file breakpoint, use the Break Here command:
  1. Open the Command Palette (Ctrl+Shift+P)
  2. Run Debug: Break Here
This inserts a debug break at the current Lua execution point.