cw.flag class
Defines the cw.flag library, the registry of single-character player flags with their names and descriptions.
On the client every registered flag is listed on the Flags page of the directory. The file adds the framework's own
flags, such as p for the physics gun, t for the tool gun and e for spawning props.
Summary
Methods
Add(flag, name, details)shared
Registers a player flag.
Get(flag)shared
Returns a registered flag.
Returns a flag's details.
Finds a flag by its display name, ignoring case.
GetName(flag, default)shared
Returns a flag's display name.
GetStored()shared
Returns every registered flag.
Methods
Registers a player flag.
On the client the flag is also added to the Flags page of the directory, shown in green when the local player has it. The details are translated when the page is shown.
cw.flag:Add('x', 'Voice Access', '#Flag_VoiceAccess_Details')
Parameters
- flag String The single flag character
- name String Display name of the flag
- details String Description of what the flag allows, can be a language phrase
Returns a registered flag.
Parameters
- flag String The flag character
Returns
- Map The flag's
nameanddetails, ornilif it is not registered
cw.flag:GetDescription(flag, default)
shared gamemodes/catwork/gamemode/core/libraries/sh_flag.lua:81Returns a flag's details.
Parameters
- flag String The flag character
- default Any optional, defaults to
nilValue returned when the flag is not registered
Returns
- String The flag's details, or
default
cw.flag:GetFlagByName(name, default)
shared gamemodes/catwork/gamemode/core/libraries/sh_flag.lua:94Finds a flag by its display name, ignoring case.
Parameters
- name String Display name of the flag
- default Any optional, defaults to
nilValue returned when no flag has that name
Returns
- String The flag character, or
default
Returns a flag's display name.
Parameters
- flag String The flag character
- default Any optional, defaults to
nilValue returned when the flag is not registered
Returns
- String The flag's name, or
default
Returns every registered flag.
Returns
- Map<Map> Flag tables with
nameanddetailskeys, keyed by flag character