UserVars¶
The UserVars
library contains wrapper methods for working with UserVars and ModVars. It allows fetching definitions of variables as well as their values.
You may also define default values to return if a variable is unset on the component/modvar.
UserVarsLib_UserVar Class¶
@field ID string
@field Client boolean
@field Server boolean
@field WriteableOnServer boolean
Defaults to `true`.
@field WriteableOnClient boolean
Defaults to `false`.
@field Persistent boolean
@field SyncToClient boolean
Defaults to `true`.
@field SyncToServer boolean
Defaults to `true`.
@field SyncOnWrite boolean
Defaults to `false`.
@field SyncOnTick boolean
Defaults to `true`.
@field DontCache boolean
Defaults to `false`
@field DefaultValue any?
UserVarsLib Class¶
Inherits from Library
.
Methods¶
GetModVarDefinition¶
Returns the definition of a mod variable.
@param modGUID GUID
@param var string
GetModVarValue¶
Returns the value of a mod var.
@param modGUID GUID
@param varName string
GetModVariables¶
Returns the mod variables of a mod.
@param modGUID GUID
GetUserVarDefinition¶
Returns the definition of a user variable.
@param varName string
GetUserVarValue¶
Returns the value of a user variable for an entity.
@param component UserVarsLib_CompatibleComponent
@param varName string
RegisterModVariable¶
Registers a mod variable.
@param modGUID GUID
@param name string
@param data UserVarsLib_ModVar?
Defaults to default values (see class).
RegisterUserVariable¶
Registers a user variable.
Must be done once for each context where you want the variable to exist.
@param name string
@param data UserVarsLib_UserVar?
Defaults to default values (see class).