Defines the cw.option library, the schema-level options: keys, sounds and, on the client, interface colors and fonts.

Schemas override them with cw.option:SetKey, cw.option:SetSound, cw.option:SetColor and cw.option:SetFont. The file sets the defaults, such as name_cash, model_cash, format_cash, the menu names and the icon_data_ keys.

Summary

Methods

Returns a schema interface color.
Returns the font used for a part of the interface.
Returns a schema option.
Returns the file path of a schema sound.
Plays a schema sound.
Sets a schema interface color.
Sets the font used for a part of the interface.
Sets a schema option.
Sets a schema sound, such as the menu click or rollover sound.

Methods

Returns a schema interface color.

Parameters

  • name String Color name

Returns

  • Color The color, or nil if it is not set

Returns the font used for a part of the interface.

Parameters

  • name String Font slot name

Returns

  • String The font name, or nil if it is not set

cw.option:GetKey(key, lowerValue)

shared gamemodes/catwork/gamemode/core/libraries/sh_option.lua:38

Returns a schema option.

Parameters

  • key String Option name
  • lowerValue Boolean optional, defaults to nil Lowercase the value when it is a String

Returns

  • Any The option's value, or nil if it is not set

See also

Returns the file path of a schema sound.

Parameters

  • name String Sound name

Returns

  • String The sound file path, or nil if it is not set

Plays a schema sound.

On the client the sound plays for the local player; on the server it is sent to every player. Does nothing if the sound is not set.

Parameters

  • name String Sound name

cw.option:SetColor(name, color)

client gamemodes/catwork/gamemode/core/libraries/sh_option.lua:131

Sets a schema interface color.

Parameters

  • name String Color name, such as 'panel_background'
  • color Color The color

Sets the font used for a part of the interface.

Parameters

  • name String Font slot name, such as 'main_text'
  • font String Name of a font created with surface.CreateFont

Sets a schema option.

Options hold schema-level settings such as menu names, cash formats, models and icons.

cw.option:SetKey('name_cash', '#HL2RP_CashName')
cw.option:SetKey('model_cash', 'models/props_lab/box01a.mdl')

Parameters

  • key String Option name
  • value Any New value

See also

cw.option:SetSound(name, sound)

shared gamemodes/catwork/gamemode/core/libraries/sh_option.lua:52

Sets a schema sound, such as the menu click or rollover sound.

Parameters

  • name String Sound name
  • sound String Sound file path

Defined in