cw.currency class
Defines the cw.currency library, a registry of named currency objects that each carry a world model and a default
amount.
cw.currency:Add creates a currency and cw.currency:Get returns one, creating it if needed. A currency object can
be called like a function to query its data.
Summary
Methods
cw.currency:Add(name, model, defaultValue)
shared gamemodes/catwork/gamemode/core/libraries/sh_currency.lua:102Creates and stores a new currency.
The key is the name lowercased with whitespace replaced by underscores. Does nothing if a currency with that key already exists.
Parameters
- name String Display name of the currency
- model String optional, defaults to
nilWorld model path - defaultValue Number optional, defaults to
nilDefault amount
Returns
- Map The new currency object, or
nilif the currency already exists
Returns a currency, creating it if it does not exist yet.
Returns an empty table while the cash_enabled config is off.
Parameters
- name String Display name or key of the currency
Returns
- Map The currency object
Returns every stored currency.
Returns an empty table while the cash_enabled config is off.
Returns
- Map<Map> Currency objects keyed by currency key