> ## Documentation Index
> Fetch the complete documentation index at: https://gluals.arnux.net/llms.txt
> Use this file to discover all available pages before exploring further.

# Use the debugger

> Breakpoints, running Lua, the Errors view and the Entity Explorer.

Start the debugger from **Run and Debug** (`Ctrl+Shift+D`) with the entry the [setup wizard](https://gluals.arnux.net/debugger/setup.md) created. Everything below needs a connected debugger.

## Breakpoints and stepping

The debugger works like any other VS Code debugger:

* Click left of a line number to add a breakpoint.
* Right-click a breakpoint and choose **Edit Breakpoint** to add a Lua condition, such as `ply:Health() < 10`, or a hit count.
* Step with `F10` (over), `F11` (into) and `Shift+F11` (out), and continue with `F5`.
* While paused, the **Variables** panel shows locals, upvalues and globals. Double-click a value to change it.
* Type Lua in the **Debug Console** (`Ctrl+Shift+Y`) to run it where the code is paused, with access to its local variables.

![Setting a breakpoint, running a file, then pausing with variable values shown inline and stepping over](https://mintcdn.com/arnux/bkVufjXIELu8fSRa/images/showcase/debugger.gif?s=aca58f6e7e01ad640dea6317bf05841a)

## Run Lua on the server or client

While connected, you can run code without leaving VS Code:

| Command | Where to find it | What it does |
| - | - | - |
| **Run Selected GLua** | Right-click selected code | Runs the selection |
| **Run GLua File** | Editor title bar or right-click | Runs the current file |
| **Refresh GLua File** | Editor title bar or right-click | Reloads the current file on the server, like Lua refresh |
| **Run Lua** | Command Palette | Runs code you type |
| **Run Command** | Command Palette | Runs a console command, such as `changelevel gm_construct` |

Code runs in the realm shown as **Realm** in the status bar. Click it to switch between server, client and shared. Client code runs on every connected player.

## Errors view

The **Errors** view in the Run and Debug sidebar collects Lua errors from the game while the debugger is connected. Repeated errors are grouped with a count. Click a stack frame to open that line in your code. Use **Clear** to empty the list.

![A Lua error appears in the Errors view, and clicking its stack frame opens the line that caused it](https://mintcdn.com/arnux/bkVufjXIELu8fSRa/images/showcase/runtime-errors.gif?s=344ba9548f849b90c855dc8c94ba49c9)

To pause the game when an error happens, set `"stopOnError": true` in `launch.json`. This also pauses on errors from other addons.

## Entity Explorer

The **Entity Explorer** in the Run and Debug sidebar lists every entity in the game. Expand one to see its NetworkVars and table values. Use the toolbar to filter by type (players, Lua entities, others) or search names and values. While the debugger is paused, click a value or its pencil button to change it.

![The Entity Explorer expanding a balloon entity to show its Force NetworkVar](https://mintcdn.com/arnux/bkVufjXIELu8fSRa/images/showcase/entity-explorer.gif?s=62bf2756e4b8de52b9e1522b6ca8d0d5)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.