Page 1 of 1

ConVar creation changes

Posted: Sun Dec 27, 2015 4:23 pm
by satoon101
Previously, if you did not want to use any ConVarFlags when creating a ConVar instance, you had to use either of the following:

Syntax: Select all

from cvars import ConVar
from cvars.flags import ConVarFlags

my_convar = ConVar('name', 'value', ConVarFlags.NONE, 'My ConVar description.')

my_convar = ConVar('name', 'value', description='My ConVar description.')


We decided, since most of the time no flags would be given anyway, to reverse the order of those 2 arguments. So now, you can just use:

Syntax: Select all

from cvars import ConVar

my_convar = ConVar('name', 'value', 'My ConVar description.')


If you do want to pass flags, you would now instead use:

Syntax: Select all

from cvars import ConVar
from cvars.flags import ConVarFlags

my_convar = ConVar('name', 'value', 'My ConVar description.', ConVarFlags.NOTIFY)


All instances of this throughout the API were changed, including the internal _ConVar class. The _ConVar class is now responsible for switching the 2 arguments internally to get the object correctly.