Garry's Mod Wiki

cvars

The cvars library allows you to control what happens when a cvar (console variable) is changed.

Methods

cvars.AddChangeCallback( string name, function callback, string identifier = "nil" )
Adds a callback to be called when the named convar changes. This does not callback convars in the menu state.This does not callback convars on the client with FCVAR_GAMEDLL and convars on the server without FCVAR_GAMEDLL.This does not callback convars on the client with FCVAR_REPLICATED.
boolean cvars.Bool( string cvar, boolean default = false )
Retrieves console variable as a boolean.
table cvars.GetConVarCallbacks( string name, boolean createIfNotFound = false )
Returns a table of the given ConVars callbacks.
number cvars.Number( string cvar, any default = nil )
Retrieves console variable as a number.
cvars.OnConVarChanged( string name, string oldVal, string newVal )
This is used internally - although you're able to use it you probably shouldn't. You are probably looking for cvars.AddChangeCallback. Called by the engine when a convar value changes.
cvars.RemoveChangeCallback( string name, string indentifier )
Removes a callback for a convar using the the callback's identifier. The identifier should be the third argument specified for cvars.AddChangeCallback.
string cvars.String( string cvar, any default = nil )
Retrieves console variable as a string.

Page Links


Special Pages


Wikis

?

Render Time: 78ms

DB GetPage 42
Generate Html 3
SaveChanges (1) 17
Render Body 0
Render Sidebar 13