Garry's Mod Wiki

GetConVarString

  string GetConVarString( string name )

Description

Returns the string value ConVar with the specified name.

This function will return an empty string if the ConVar does not exist. Use cvars.String to specify your own default.

Will return the value of game.MaxPlayers (as a string) if maxplayers is specified as the ConVar name, even though maxplayers is not a ConVar. (it is a console command) You should be using aforementioned Lua function instead for that case.

In performance intensive places such as think and rendering callbacks/hooks, it is advised to use ConVar:GetString on a ConVar object directly, which be retrieved via GetConVar, or from existing CreateConVar call.

Arguments

1 string name
Name of the ConVar to get the value of.

Returns

1 string
The ConVar's value.