Overview
@call_arg marks a function parameter that requires special handling. Use it when you write a wrapper around base gmod functions and still want GLuaLS to understand the names, callbacks, colors, panels, skins, or scripted-class metadata passed through that wrapper. This system was implemented to replace previously hardcoded handling of special base gmod functions / methods / classes to instead implement a more generic system that can be used for other advanced use cases.
Most addons do not need this annotation. The official GMod annotations already apply it to built-in functions like util.AddNetworkString, net.Start, hook.Add, vgui.Register, and derma.DefineSkin.
It is expected that you know what you are doing if you use this annotation.
Syntax
@call_arg directly above the @param it describes.
StartMessage("...") gets the same net message lookup, completion, hover, and navigation as net.Start("..."). While the net system already does try to detect cases similar to the above code, this is more of an example of how it could be used to add detection for wrappers that aren’t currently autodetected.
For overloaded signatures, use @overload_call_arg directly above the @overload it describes:
Supported roles
| Domain | Roles | Used for |
|---|---|---|
gmod.net_message | define, start, receive, callback, reference | Net message definitions, sends, receives, callbacks, and name lookups |
gmod.hook | add, emit, callback, gamemode_table, remove, reference | Hook registration, hook calls, callback inference, and hook name lookup |
gmod.concommand | define, callback | Console command registration and callback tracking |
gmod.convar | define, define_server, define_client | Server and client ConVar registration |
gmod.timer | define, callback, simple | Timer creation and callback tracking |
gmod.vgui_panel | define, define_control, table, base, reference | VGUI panel registration, inheritance, and panel name lookup |
gmod.derma_skin | define, reference | Derma skin registration and skin name lookup |
gmod.network_var | type, define, define_element | Entity NetworkVar and NetworkVarElement accessor generation |
gmod.class_base | reference | DEFINE_BASECLASS inheritance metadata |
gmod.gamemode | reference | DeriveGamemode inheritance metadata |
gmod.color | r, g, b, a | Color previews for custom color constructors |
Hooks with callbacks
Use one role for the hook name and one role for the callback function:emit for functions that call hooks:
VGUI panels
Usedefine, table, and base for a vgui.Register wrapper:
define_control instead of define for derma.DefineControl wrappers. Use reference for functions that create or look up panels by name.
Derma skins
Usegmod.derma_skin when wrapping Derma skin functions:
DefineSkin("MySkin", ...) and UseSkin("MySkin").
Scripted classes
Usegmod.network_var when wrapping entity NetworkVar helpers:
define_element for wrappers around NetworkVarElement, because element accessors always return numbers.
For gamemode inheritance wrappers, mark the base-name parameter:
gmod.class_base reference for wrappers around DEFINE_BASECLASS.
Priority
An optional third argument breaks ties when one parameter can inherit multiple roles:See also
- Network analysis: net message tracking
- Hook intelligence: hook completion and callback inference
- VGUI support: panels and Derma skins