cvars.AddChangeCallback

From GMod Wiki

Jump to: navigation, search
Function
Syntax cvars.AddChangeCallback( String ConVar, Function Callback )
Where is this used?
Description:
Registers a callback function to be called when the specified ConVar's value is changed.
Returns: nil
Part of Library: cvars
Realm: NewerShared.png
BBCode Link: [b][url=http://wiki.garrysmod.com/?title=Cvars.AddChangeCallback]Cvars.AddChangeCallback [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b]



Example

 
CreateConVar("my_cvar", "", FCVAR_NOTIFY)
local function funcCallback(CVar, PreviousValue, NewValue)
	print(CVar.." changed from "..PreviousValue.." to "..NewValue.."!")
end
cvars.AddChangeCallback("my_cvar", funcCallback)
 

Notes

See Also

Personal tools
Namespaces
Variants
Actions
Navigation
Lua Scripting
Functions
Hooks
Toolbox