Functions within the
menu
table (e.g., menu.add_toggle()
, menu.add_slider()
) are static registration calls used to define the user interface layout. You must not call these functions inside frequently executed events (like EventType.Draw
or EventType.Tick
). They should only be called once, at the very beginning of your script’s execution (on initialization or setup), to prevent instability and incorrect menu state.Access
All menu C++ functions are exposed to your Lua script via a single global table namedmenu
. You access individual values by using the dot (.
) or bracket ([]
) operator on this table.
Menu Usage Example
Functions
This section lists all available C++ functions exposed within the globalmenu
table. These functions allow you to register new widgets (labels, toggles, sliders, etc.), retrieve configuration values, and directly manipulate the user interface elements.
add_label
Registers a non-interactive label or section divider in the menu. Returns a boolean indicating the success of the item creation.The text to display for the label.
The safe status for the widget. If
false
, the widget will be hidden when Hide Unsafe is enabled. Defaults to true
.add_toggle
Registers an interactive toggle switch widget in the menu. Returns a boolean indicating the success of the item creation.The text label displayed next to the toggle switch in the menu.
The unique configuration key used to get and set the toggle’s boolean value via
get_item
and set_item
.The default value (initial state) for the toggle. Defaults to
false
.The safe status for the widget. If
false
, the widget will be hidden when Hide Unsafe is enabled. Defaults to true
.add_slider_int
Registers an interactive slider widget that allows selecting an integer value within a defined range. Returns a boolean indicating the success of the item creation.The text label displayed next to the slider in the menu.
The unique configuration key used to get and set the slider’s integer value via
get_item
and set_item
.The default value (initial state) of the slider. Defaults to
0
.The minimum value the slider can be set to. Defaults to
0
.The maximum value the slider can be set to. Defaults to
100
.The safe status for the widget. If
false
, the widget will be hidden when Hide Unsafe is enabled. Defaults to true
.add_slider_float
Registers an interactive slider widget that allows selecting an floating-point value within a defined range. Returns a boolean indicating the success of the item creation.The text label displayed next to the slider in the menu.
The unique configuration key used to get and set the slider’s floating-point value via
get_item
and set_item
.The default value (initial state) of the slider. Defaults to
0
.The minimum value the slider can be set to. Defaults to
0
.The maximum value the slider can be set to. Defaults to
100
.The safe status for the widget. If
false
, the widget will be hidden when Hide Unsafe is enabled. Defaults to true
.add_single_combo
Registers a single combo box widget that allows selecting a single item from a list of strings. Returns a boolean indicating the success of the item creation.The text label displayed next to the single combo box in the menu.
The unique configuration key used to get and set the selected item’s index (as a number) via
get_item
and set_item
.The initial 0-based index (initial state) of the single combo box. Defaults to
0
(the first item).A Lua table (list) of strings defining the selectable options (e.g.,
{"Option A", "Option B"}
). Defaults to an empty list.The safe status for the widget. If
false
, the widget will be hidden when Hide Unsafe is enabled. Defaults to true
.add_multi_combo
Registers a multi combo box widget that allows the user to select multiple items from a list of strings. Returns a boolean indicating the success of the item creation.The text label displayed next to the multi combo box in the menu.
The unique configuration key used to get and set the selected item indices (as a table of numbers) via
get_item
and set_item
.A Lua table (list) of numbers defining the initial 0-based indices (initial state) of the multi combo box (e.g.,
{0, 3, 4}
). Defaults to an empty list.A Lua table (list) of strings defining the selectable options (e.g.,
{"Option A", "Option B"}
). Defaults to an empty list.The safe status for the widget. If
false
, the widget will be hidden when Hide Unsafe is enabled. Defaults to true
.add_colorpicker
Registers a color picker widget that allows the user to choose an RGBA color. Returns a boolean indicating the success of the item creation.The text label displayed next to the color picker in the menu.
The unique configuration key used to get and set the colorpickers Color4 value via
get_item
and set_item
.The default color (initial state) for the picker. Defaults to a fully transparent black color (1, 1, 1, 1).
If
true
, the color picker will include an Alpha (transparency) slider. Defaults to true
.If
true
, the color picker will be inlayed further down below the last widget. Defaults to false
.get_item
Get the value of a specific script configuration value.The unique string key of the configuration to get the value from.
set_item
Set the value of a specific script configuration value. Returns a boolean indicating the success of the set.The unique string key of the configuration to set the value for.
The new value to assign to the configuration. The value type must match the type of the configuration.
get_global
Get the value of a specific global configuration value.The global section to get the configuration value from.
The unique string key of the configuration to get the value from.
set_global
Set the value of a specific global configuration value. Returns a boolean indicating the success of the set.The global section to set the configuration value for.
The unique string key of the configuration to set the value for.
The new value to assign to the configuration. The value type must match the type of the configuration.