Garry's Mod Wiki

ConVar

An object returned by CreateConVar, CreateClientConVar (which uses CreateConVar internally), and GetConVar.

It represents a console variable. See this page for more information.

Methods

boolean ConVar:GetBool()
Tries to convert the current string value of a ConVar to a boolean.
Returns the default value of the ConVar
number ConVar:GetFlags()
Returns the FCVAR enum flags of the ConVar
number ConVar:GetFloat()
Attempts to convert the ConVar value to a float
Returns the help text assigned to that convar.
number ConVar:GetInt()
Attempts to convert the ConVar value to a integer.
number ConVar:GetMax()
Returns the maximum value of the ConVar
number ConVar:GetMin()
Returns the minimum value of the ConVar
string ConVar:GetName()
Returns the name of the ConVar.
string ConVar:GetString()
Returns the current ConVar value as a string.
boolean ConVar:IsFlagSet( number flag )
Returns whether the specified flag is set on the ConVar
ConVar:Revert()
Reverts ConVar to its default value This can only be ran on ConVars created from within Lua.
ConVar:SetBool( boolean value )
Sets a ConVar's value to 1 or 0 based on the input boolean. This can only be ran on ConVars created from within Lua.
ConVar:SetFloat( number value )
Sets a ConVar's value to the input number. This can only be ran on ConVars created from within Lua.
ConVar:SetInt( number value )
Sets a ConVar's value to the input number after converting it to an integer. This can only be ran on ConVars created from within Lua.
ConVar:SetString( string value )
Sets a ConVar's value to the input string. This can only be ran on ConVars created from within Lua.