Neverlose
Ask or search…
K
Comment on page
🎲

cvar

Example

cvar.mp_teammates_are_enemies:int(1)
cvar.clear:call()

Functions:

:call

cvar_object:call(...)
Name
Type
Description
...
Arguments passed to the callback
Executes a ConCommand or cvar callback, passing its arguments to it.

:int

Get value
Set value
cvar_object:int(): number
cvar_object:int(value: number[, raw: boolean ])
Name
Type
Description
value
number
New int value
raw
boolean
Optional. If true then the raw value will be set
Gets or sets the ConVar int value.

:float

Get value
Set value
cvar_object:float(): number
cvar_object:float(value: number[, raw: boolean ])
Name
Type
Description
value
number
New float value
raw
boolean
Optional. If true then the raw value will be set
Gets or sets the ConVar float value.

:string

cvar_object:string([ value: any ]): string
Name
Type
Description
value
any
New string value. If not specified then returns the string value of the ConVar
Gets or sets the ConVar string value.

:set_callback

ConVar
Command
You can access the cvar_object, old_value and new_value by adding them to the function arguments.
You can access the cvar_object and args by adding them to the function arguments. Inside the callback, return false to prevent the command from being executed.
cvar_object:set_callback(callback: function)
Name
Type
Description
callback
function
Lua function to call
Registers the callback to the specified ConVar/Command. The registered function will be called every time the specified convar value is updated.

:unset_callback

cvar_object:unset_callback(callback: function)
Name
Type
Description
callback
function
Lua function that was passed to the :set_callback function
Unregisters the callback that was set via the :set_callback function from the specified ConVar/Command.
Last modified 1yr ago