cw.currency.Class object
Object table CLASS_TABLE in core/libraries/sh_currency.lua
Summary
Methods
Makes the currency object callable as a shorthand for
CLASS_TABLE:Query.Create(name)shared
Creates a new currency object with empty data.
GetDefault()shared
Returns the currency's default amount.
GetModel()shared
Returns the currency's world model.
Query(key, failSafe)shared
Returns a value from the currency's data.
SetData(key, value)shared
Sets a value in the currency's data.
SetDefault(amount)shared
Sets the currency's default amount.
SetModel(model)shared
Sets the currency's world model.
Methods
CLASS_TABLE:__call(parameter, failSafe)
shared gamemodes/catwork/gamemode/core/libraries/sh_currency.lua:25Makes the currency object callable as a shorthand for CLASS_TABLE:Query.
local model = currency('model', 'models/props_c17/briefcase001a.mdl')
Parameters
- parameter String Data key to read
- failSafe Any optional, defaults to
nilValue returned when the key is not set
Returns
- Any The stored value, or
failSafe
Creates a new currency object with empty data.
Use cw.currency:Add to create and store a currency.
Parameters
- name String Display name of the currency
Returns
- Map The new currency object
Returns the currency's default amount.
Returns
- Number The default amount, 0 when none is set
Returns the currency's world model.
Returns
- String The model path; a briefcase model when none is set
CLASS_TABLE:Query(key, failSafe)
shared gamemodes/catwork/gamemode/core/libraries/sh_currency.lua:47Returns a value from the currency's data.
Parameters
- key String Data key to read
- failSafe Any optional, defaults to
nilValue returned when the key is not set
Returns
- Any The stored value, or
failSafe
Sets a value in the currency's data.
Parameters
- key String Data key to set
- value Any New value
Sets the currency's default amount.
Parameters
- amount Number The default amount
Sets the currency's world model.
Parameters
- model String Model path