Skip to main content
GLua Language Server uses a combination of static analysis and the bundled Garry’s Mod wiki dataset to provide precise IntelliSense across your entire workspace. It tracks types through function calls, string literals, loops, and metatables so that completion and hover information always resolve to the correct class.

Type tracking

The server understands how common GLua functions transform types and propagates that knowledge through your code.

Player lookup

When you call player.GetByID, the server knows the result is a Player entity:

Panel creation

vgui.Create with a known panel class returns that type:

Loop iteration

ipairs over a player list types each element as Player:

Typed hook sender

When you register a hook with a typed sender parameter, the callback receives the correct type:

Entity methods

Inside ENT methods, self is typed as Entity:

Typing your own functions

You can add explicit types to your own functions with annotations, or let the server infer them from usage.

Supported annotation tags

GLua Language Server uses the same annotation dialect as Lua Language Server. You can also use union types, optional parameters, and array syntax:

How inference falls back

When the server cannot determine an exact type, it uses the following strategy:
  1. Ambiguous sets — If an object could be one of several types, the server finds the most specific common base class. For example, a value that is sometimes a Player and sometimes an NPC falls back to Entity.
  2. Unrecognisable values — If a type cannot be inferred at all, it falls back to any. You will still get generic Lua completions, but no Garry’s Mod specific methods.
  3. Explicit annotations always win — If you add a ---@type or ---@param annotation, it overrides any inferred type.
Add explicit annotations at module boundaries (shared files called from multiple realms, library functions used by other addons) to improve completion accuracy across your entire workspace.