Menu
Menu provides the ability to create and remove menus for script functions in the Pathing UI.
tip
You can find a tutorial for creating menus in the tutorial section!
Fields
| Field | Type | Description | 
|---|---|---|
| Name | string | The name and display text of the menu. | 
| OnClick | function(Menu) | The function called when the menu is clicked or toggled. Can be nil. | 
| CanCheck | boolean | Indicates if the menu has a checkbox. Can be nil. | 
| Checked | boolean | Indicates if the menu checkbox is checked. Can be nil. | 
| Tooltip | string | The tooltip used by the menu. Can be nil. | 
Functions
| Function | Description | 
|---|---|
| Add | Adds a new menu. | 
| Remove | Removes the specified menu item. | 
Menu:Add(name, onClick, canCheck, checked, tooltip)
Adds a new menu to the menu you call this function on.
Parameters
| Parameter | Type | Description | 
|---|---|---|
| name | string | The name and display text of the menu. | 
| onClick | function(Menu) | The function called when the menu is clicked or toggled. May be nil. | 
| canCheck | boolean | OptionalIf provided, indicates if the menu has a checkbox. | 
| checked | boolean | OptionalIf provided, indicates if the menu checkbox is checked. | 
| tooltip | string | OptionalIf provided, sets the tooltip used by the menu. | 
Returns | Menu
The new menu
Usage
menu.lua
local function doSomething(Menu)
    print("Menu clicked, current state: " .. tostring(Menu.Checked))
end
local rootMenu = Menu:Add("Example Menu", nil, nil, nil, "This is an example menu")
local subMenuItem = rootMenu:Add("Click me!", doSomething, true, false, "This menu logs its state when clicked")
Menu:Remove(menuItem)
Removes the specified menu item.
Parameters
| Parameter | Type | Description | 
|---|---|---|
| menuItem | Menu | The menu item to remove. | 
Usage
menu.lua
local rootMenu = Menu:Add("Example Menu", nil, nil, nil, "This is an example menu")
local function removeThisMenu(Menu)
    rootMenu:Remove(Menu)
end
local subMenuItem = rootMenu:Add("Click me!", removeThisMenu, nil, nil, "This menu removes itself when clicked")