cw.selector.Class object
Object table CLASS_TABLE in core/libraries/sh_selector.lua
Summary
Methods
Methods
CLASS_TABLE:AddOption(text, color)
shared gamemodes/catwork/gamemode/core/libraries/sh_selector.lua:110Adds a numbered option.
On the client a new page starts after every six options.
Parameters
- text String Option text; converted with
tostring - color Color optional, defaults to
nilText color;cw.selector.COLOR_ORANGEwhennil
CLASS_TABLE:AddText(text, color)
shared gamemodes/catwork/gamemode/core/libraries/sh_selector.lua:81Adds a line of text that cannot be chosen.
Parameters
- text String Text to show; converted with
tostring - color Color optional, defaults to
nilText color;cw.selector.COLOR_CREAMwhennil
On the server
Sends the selector to its players and waits for their choice.
Falls back to every player when CLASS_TABLE:SetPlayer was not called. Choosing an option other
than Back, Next or Exit ends the selector for that player.
On the client
Shows the selector on the local player's screen.
Adds the Back, Next and Exit options to the current page the first time it is shown. Uses
cw.client:AddPlayerOption, which is not defined in Catwork, so this errors unless a plugin
provides it.
Defined in
Shows the selector's next page, if there is one.
Shows the selector's previous page, if there is one.
CLASS_TABLE:Select(key)
client internal gamemodes/catwork/gamemode/core/libraries/sh_selector.lua:210Internal
This function is internal. It is not part of the public API and may change without notice.
Called by the player option set up in CLASS_TABLE:Create.
Chooses an option on the current page by its number key.
Calls the callback, then goes back or forward a page for keys 7 and 8.
Parameters
- key Number Number key that was pressed
Returns
- Boolean
truewhen the selector should close,falseafter changing page
CLASS_TABLE:SetCallback(Callback)
shared gamemodes/catwork/gamemode/core/libraries/sh_selector.lua:66Sets the function called when an option is chosen.
On the server it is called as Callback(player, page, key, text); on the client as
Callback(page, key, text). Keys 1 to 6 are options, 7 is Back, 8 is Next and 9 is Exit.
Parameters
- Callback Function Called with the chosen option
CLASS_TABLE:SetCanExit(bCanExit)
shared gamemodes/catwork/gamemode/core/libraries/sh_selector.lua:73Sets whether the selector has an Exit option.
Parameters
- bCanExit Boolean Whether the selector can be exited
CLASS_TABLE:SetPaginateText(bPaginateText)
shared gamemodes/catwork/gamemode/core/libraries/sh_selector.lua:56Sets whether text lines also start a new page once a page has six entries.
Parameters
- bPaginateText Boolean Whether text is paginated
Sets which players the selector is sent to.
Without a call, CLASS_TABLE:Create sends it to every player.
Parameters
- player Player A single player, or a List of players