Summary

Methods

Adds a numbered option.
Adds a line of text that cannot be chosen.
Create()shared
Sends the selector to its players and waits for their choice.
Shows the selector's next page, if there is one.
Shows the selector's previous page, if there is one.
Select(key)client internal
Chooses an option on the current page by its number key.
Sets the function called when an option is chosen.
Sets whether the selector has an Exit option.
Sets whether text lines also start a new page once a page has six entries.
Sets which players the selector is sent to.

Methods

CLASS_TABLE:AddOption(text, color)

shared gamemodes/catwork/gamemode/core/libraries/sh_selector.lua:110

Adds 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 nil Text color; cw.selector.COLOR_ORANGE when nil

CLASS_TABLE:AddText(text, color)

shared gamemodes/catwork/gamemode/core/libraries/sh_selector.lua:81

Adds a line of text that cannot be chosen.

Parameters

  • text String Text to show; converted with tostring
  • color Color optional, defaults to nil Text color; cw.selector.COLOR_CREAM when nil

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:210

Internal

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 true when the selector should close, false after changing page

CLASS_TABLE:SetCallback(Callback)

shared gamemodes/catwork/gamemode/core/libraries/sh_selector.lua:66

Sets 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:73

Sets 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:56

Sets 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

Defined in