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

# Get Started with GLua Language Server

> A five-minute tour of GLua Language Server: type tracking, realm checks, net message validation, and inline suppressions with real code examples.

This quickstart walks you through the core features of GLua Language Server in about five minutes. You will see how completions follow your values, how realms protect you from runtime errors, how net messages are validated end to end, and how to silence a diagnostic inline.

## 1) Completion follows your values

When you assign a known type, the extension suggests the right members. Type a player reference, a panel, or a loop variable, and the completion list updates automatically.

```lua theme={null}
local ply = player.GetByID(1)
ply: -- suggests :GetName, :Alive, :Kick, etc.

local frame = vgui.Create("DFrame")
frame: -- suggests :SetTitle, :SetSize, :MakePopup, etc.

for _, ent in ipairs(ents.GetAll()) do
    ent: -- suggests :GetPos, :GetClass, :Remove, etc.
end
```

## 2) Your own functions

You can add type annotations so the extension understands your code, or let it infer types from usage.

<CodeGroup>
  ```lua Annotated theme={null}
  ---@param target Player
  ---@param damage number
  ---@return boolean
  function HurtPlayer(target, damage)
      if not IsValid(target) then return false end
      target:TakeDamage(damage)
      return true
  end
  ```

  ```lua Inferred theme={null}
  function HurtPlayer(target, damage)
      if not IsValid(target) then return false end
      target:TakeDamage(damage)
      return true
  end
  ```
</CodeGroup>

With annotations, callers get completions and diagnostics for every parameter. Without them, the extension still infers types from how the function is used in your codebase.

## 3) Realms are not a suggestion

GLua runs on the server, the client, or both. The extension reads the file path and flags API calls that do not belong in the current realm.

```lua theme={null}
-- File: lua/autorun/client/my_addon.lua (clientside file)

local ply = LocalPlayer()
ply:Kick("Reason") -- realm error: Kick is server-only
```

The diagnostic appears immediately, so you know to move that code to a server file or use a net message instead.

## 4) Net messages checked end to end

When you define a net message sender and receiver, the extension compares the write and read signatures. If the payload types or order do not match, it reports a diagnostic.

```lua theme={null}
-- Server: lua/autorun/server/net.lua
util.AddNetworkString("MyMessage")
net.Start("MyMessage")
net.WriteString("Hello")
net.WriteEntity(someEntity)
net.Send(ply)
```

```lua theme={null}
-- Client: lua/autorun/client/net.lua
net.Receive("MyMessage", function()
    local msg = net.ReadString()
    local id = net.ReadUInt(8) -- payload mismatch: server sent WriteEntity, client reads ReadUInt
end)
```

The mismatch between `WriteEntity` and `ReadUInt` is flagged before you run the game.

## 5) Silencing a finding

If a diagnostic is a false positive for your project, you can suppress it inline with a comment:

```lua theme={null}
-- glua-ignore
local x = SomeAmbiguousCall()
```

Place the suppression comment on the line before the statement you want to ignore. The extension stops reporting the finding without affecting other diagnostics.

## 6) Commands worth knowing

Open the Command Palette (**Ctrl+Shift+P** or **Cmd+Shift+P**) and type `GLua:` to find these commands:

| Command                              | What it does                                                      |
| ------------------------------------ | ----------------------------------------------------------------- |
| `GLua: Show Net Message Graph`       | Visualise net message senders and receivers across your workspace |
| `GLua: Create Linter Config File`    | Generate a `.glua.json` file in the current workspace root        |
| `GLua: Create Formatter Config File` | Generate a `.gluafmtrc.json` file in the current workspace root   |
| `GLua: Re-index Workspace`           | Force a full re-index after large changes or dataset updates      |
| `GLua: Open Settings`                | Jump to the GLua Language Server settings panel                   |

Try running `GLua: Show Net Message Graph` on your project to see the net message analysis in action.


## Related topics

- [GLua Language Server: GMod Lua IDE Support](/index.md)
- [Install GLua Language Server for VS Code](/installation.md)
- [Configure GLua Language Server](/configuration/overview.md)
- [GLua Language Server Performance](/reference/performance.md)
