CreateConVar
Example
Code that will create a Convar and a chatprint with the content of the convar.
Output: Server ConVar value: 1
Creates a console variable (ConVar).
Generally these are used for settings, which can be stored automatically across sessions if desired. They are usually set via an accompanying user interface clientside, or listed somewhere for dedicated server usage, in which case they might be set via server.cfg
on server start up.
This cannot be a name of an engine console command or console variable. It will throw an error if it is. If it is the same name as another lua ConVar, it will return that ConVar object.
nil
if convar could not be created. (such as when there's a console command with the same name)
If a ConVar already exists (including engine ones), it will simply return the already existing ConVar without modifying it in any way.
Code that will create a Convar and a chatprint with the content of the convar.