local selection = menu.add_selection("group", "name", {"item1", "item2", "item3"})
get
returns the current active item index
Example
print(selection:get())
set
sets the active item index
void set(<int> active_item_index)
Example
selection:set(1) -- set active item to "item1"
get_item_name
returns the item name for the passed index
string get_item_name(<int> item)
Example
print(selection:get_item_name(1)) -- prints "item1"
get_items
returns an indexed table of all the items
Example
local items = selection:get_items()print(items[0], items[1]) -- prints "item1" and "item2"
set_items
overrides the entire list of items
void set_items(string[] items)
Example
selection:set_items({"new item1", "new item2"})
add_item
adds an item to the list
void add_item(string item)
Example
selection:add_item("item4")
set_visible
sets whether this control is visible
void set_visible(<bool> is_visible)
Example
selection:set_visible(true)
add_color_picker
adds a color picker sub control
color_picker_t add_color_picker(<string> name, [optional] <color_t> default_color, [optional] <bool> has_alpha)
Example
local colly = selection:add_color_picker("bruh color")
add_keybind
adds a keybind sub control
keybind_t add_keybind(<string> name, [optional] <int> default_key)
Example
local keybind = selection:add_keybind("bruh key")