list_t

local list = menu.add_list("group", "name", {"item1", "item2", "item3"})

get

returns the current active item index

int get()

Example

print(list:get())

get_active_item_name

returns the current active item name

string get_active_item_name()

Example

print(list:get_active_item_name())

set

sets the active item index

void set(<int> active_item_index)

Example

list:set(1) -- set active item to "item1"

set_by_name

sets the active item index by name

void set_by_name(<string> item_name)

Example

list:set_by_name("item1") -- set active item to "item1"

get_item_name

returns the item name for the passed index

string get_item_name(<int> item)

Example

print(list:get_item_name(1)) -- prints "item1"

get_items

returns an indexed table of all the items

string[] get_items()

Example

local items = list: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

list:set_items({"new item1", "new item2"})

add_item

adds an item to the list

void add_item(string item)

Example

list:add_item("item4")

remove_item

removes an item from the list

void remove_item(string item)

Example

list:remove_item("item1")

set_visible

sets whether this control is visible

void set_visible(<bool> is_visible)

Example

list: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 = list: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 = list:add_keybind("bruh key")

Last updated