Overview
While connected, run Lua code on the server from VS Code. All options below except refresh require an execution realm. The selected realm controls where the code runs.Realm targeting
By default, code runs on the server realm. You can change the selected realm in either place:- Command Palette → GLua: Set Realm
- Realm selector on bottom status bar
client, code runs on all connected players. GLuaLS sends a net message to all clients with the code to execute. You can find this code in the generated debug.lua file in autorun.
Run selected Lua
- Select any Lua code in the editor
- Right-click → GLua: Run Selected
Run current file
This runs the saved current file from your workspace. GLuaLS sends the file path to the server for execution.
- Open the Command Palette (
Ctrl+Shift+P) - Run GLua: Run Current File
Run a server command
Execute a SRCDS console command:- Open the Command Palette
- Run GLua: Run Command
- Type the command (e.g.,
lua_run print("Hello"))
Refresh File (Lua Refresh / Hot Reload)
Refresh a file on the server without restarting. Use this if you have Lua refresh disabled.- Make your changes in the editor and save
- Right-click in the editor → GLua: Refresh File on Server
Debug Console
The Debug Console (Ctrl+Shift+Y) is the most direct way to interact. Any input is evaluated as a Lua expression on the server (or the targeted realm):
lua_run in the server console, but VS Code shows the output.