Interfacing with the user interface and overlay
ui.button(tab, column, name, callback)
Creates a new button. The return value should not be used with
ui.set/ui.get.
ui.checkbox(tab, column, name)
Creates a new checkbox. Returns a value that can be passed to
ui.get/ui.set.
ui.color_picker(tab, column, name, r, g, b, a)
Creates a new color picker. The color picker is placed to the right of the previous menu item.
ui.combobox(tab, column, name, ...)
Creates a new combobox. Returns a value that can be passed to
ui.get/ui.set.
ui.get(item)
For a checkbox, returns true or false. For a slider, returns an integer/float. For a combobox, returns a string. For a multiselect combobox, returns an array of strings. For a hotkey, returns true if the hotkey is active. For a color picker, returns r, g, b, a(, effect, speed if present). Throws an error on failure.
ui.hotkey_button(tab, column, name, inline, default)
Creates a new hotkey button. Returns a value that can be passed to
ui.getto see if the hotkey is pressed.
ui.is_menu_open()
Returns true if the menu is currently open.
ui.listbox(tab, container, name, items)
Creates a new list box. Calling
ui.geton a list box will return the zero-based index of the currently selected string.
ui.menu_pos()
Returns the x, y of the menu, even when closed.
ui.mouse_pos()
Returns current x, y mouse coordinates.
ui.multiselect(tab, column, name, ...)
Creates a new multiselect. Returns a value that can be passed to
ui.get/ui.set.
ui.name(item)
Returns the display name of an item.
ui.reference(tab, column, name)
Do not call this from inside a function. Returns a reference that can be passed to
ui.set/ui.get. This allows you to access built-in menu items. This function returns multiple values when the specified menu item is followed by unnamed menu times, like color pickers or hotkeys.
ui.set(item)
For checkboxes, pass true or false. For a slider, pass a integer/float that is within the slider’s minimum/maximum values. For a combobox, pass a string value. For textboxes, pass a string value. For a multiselect, pass zero or more strings. For referenced buttons, the callback is ignored regardless of the value. For color pickers, pass the arguments r, g, b, a(, effect, speed).
ui.set_callback(item, callback)
Sets the callback of a custom menu item.
ui.set_enabled(item, enabled)
Sets the enabled state of the menu item.
ui.set_visible(item, visible)
Sets the visibility of the menu item.
ui.string(tab, column, name)
Creates a string UI element. Can be used to store arbitrary strings in configs. No menu item is created. Returns a rvalue that can be passed to
ui.get/ui.set.
ui.text(tab, column, name)
Creates a new text label.
ui.textbox(tab, column, name)
Creates a new text box. Returns a value that can be passed to
ui.get.
ui.type(item)
Returns the type of an element.