Overview
GMod networking requires matchingnet.Start(name) and net.Write* calls on one realm with net.Receive(name) and net.Read* calls on the other. GLuaLS tracks these pairs across your workspace and reports mismatches before you run the game.
What is validated
Message registration
Everynet.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
Eachnet.Start(name) sender should have a matching net.Receive(name) receiver somewhere in your workspace:
Read/write type mismatch
Thenet.Read* call sequence must match the net.Write* call sequence for the same message type:
Read/write order mismatch
Read order must match write order. GLuaLS compares the read call sequence against the write call sequence.Diagnostic codes
| Code | Description |
|---|---|
gmod-unknown-net-message | net.Start(name) uses a name not registered with util.AddNetworkString |
gmod-net-missing-network-counterpart | A sender or receiver exists, but GLuaLS found no matching counterpart with the same message name |
gmod-net-read-write-type-mismatch | net.Read* type doesn’t match the net.Write* type for the same sequence position |
gmod-net-read-write-order-mismatch | The order of reads doesn’t match the order of writes |
gmod-net-read-write-bits-mismatch | Literal bit-width argument differs between a matched net.WriteUInt/net.ReadUInt (or similar) pair |
Smart completions
When typing the name argument tonet.Start() or net.Receive(), GLuaLS autocompletes with known network message names from your workspace.
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 undergmod.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 GMod settings for the full reference on network-related configuration options.
Limitations
- GLuaLS does not track dynamic message names computed at runtime, such as
net.Start("msg" .. id) - GLuaLS does not track conditional logic around
net.Write*calls - GLuaLS checks only files included in workspace analysis, so files outside the current analysis scope do not count as counterparts