The cvars library allows you to control what happens when a cvar (console variable) is changed.
cvars.AddChangeCallback( string name, function callback, string identifier = "nil" )
Adds a callback to be called when the named convar changes. This does not callback convars in the menu state.Issue Tracker: 1440This does not callback convars on the client with FCVAR_GAMEDLL and convars on the server without FCVAR_GAMEDLL.Issue Tracker: 3503This does not callback convars on the client with FCVAR_REPLICATED.Issue Tracker: 3740
table cvars.GetConVarCallbacks( string name, boolean createIfNotFound = false )
Returns a table of the given ConVars callbacks.
cvars.OnConVarChanged( string name, string oldVal, string newVal )
This is used internally - although you're able to use it you probably shouldn't. You are probably looking for cvars.AddChangeCallback. Called by the engine when a convar value changes.
cvars.RemoveChangeCallback( string name, string indentifier )
Removes a callback for a convar using the the callback's identifier. The identifier should be the third argument specified for cvars.AddChangeCallback.