Skip to main content

Overview

GMod networking requires senders and receivers to use the same message name and payload layout. GLuaLS connects these calls across your workspace and reports mistakes before you run the game.

What is validated

Message registration

Every net.Start(name) call must have a corresponding util.AddNetworkString(name). In real Garry’s Mod code, util.AddNetworkString must run on the server. GLuaLS checks for that registration across the workspace so it can still connect senders and receivers across files.

Missing counterpart

Each net.Start(name) sender should have a matching net.Receive(name) receiver in the expected realm:

Read/write type mismatch

The net.Read* call sequence must match the net.Write* call sequence for the same message type:

Conditional and repeated payloads

GLuaLS understands reads and writes inside if, for, while, and repeat blocks. It treats these operations as optional or repeated instead of reporting a simple count mismatch. If both sides use compatible loops or branches, they are matched as the same payload flow. When the code is too dynamic to compare safely, GLuaLS avoids guessing.

Aliases and wrappers

Aliases and wrappers around the standard GMod network functions work automatically. You do not need to add annotations to them. For example, you can use local aliases:
You can also put a complete network message in a helper function:
GLuaLS also supports read and write helpers, receive helpers, and helpers that split net.Start from the final send call.
If your library replaces the GMod network API instead of calling net.*, use @call_arg for message names and receive callbacks, net_send for send functions, and net_payload for read and write functions. Normal wrappers do not need these attributes.

Diagnostic codes


Smart completions

GLuaLS completes known message names in net.Start() and net.Receive(). Inside a receive callback, it can also suggest the expected net.Read* calls in payload order.

Hover and navigation

Hover over a network message name to see its known senders, receivers, and payload layout. Code lenses show how many matching senders and receivers exist and let you jump to them.

Cross-file tracking

Network analysis works across files. GLuaLS tracks messages registered in one file, sent in a second, and received in a third as one flow.

Configuration

Most network flow checks are configured under gmod.network. Disable all network flow analysis with gmod.network.enabled. To silence one diagnostic code, use diagnostics.disable with the code name, such as "gmod-net-read-write-type-mismatch". See the Garry’s Mod settings for the full reference on network-related configuration options.

Limitations

  • Message names must resolve to a known string. A value such as "msg" .. id cannot be connected to one message flow.
  • Code outside your workspace or configured libraries cannot count as a sender, receiver, or registration.
  • Runtime behavior that cannot be determined from the code is skipped rather than guessed.

VS Code integration

Network diagnostics run in the background. Diagnostics appear as squiggly underlines and in the Problems panel. Configure them in the settings panel. See Garry’s Mod settings for the full network configuration reference.