Skip to main content

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​

FieldTypeDescription
NamestringThe name and display text of the menu.
OnClickfunction(Menu)The function called when the menu is clicked or toggled. Can be nil.
CanCheckbooleanIndicates if the menu has a checkbox. Can be nil.
CheckedbooleanIndicates if the menu checkbox is checked. Can be nil.
TooltipstringThe tooltip used by the menu. Can be nil.

Functions​

FunctionDescription
AddAdds a new menu.
RemoveRemoves the specified menu item.


Adds a new menu to the menu you call this function on.

Parameters​

ParameterTypeDescription
namestringThe name and display text of the menu.
onClickfunction(Menu)The function called when the menu is clicked or toggled. May be nil.
canCheckboolean
Optional
If provided, indicates if the menu has a checkbox.
checkedboolean
Optional
If provided, indicates if the menu checkbox is checked.
tooltipstring
Optional
If 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")


Removes the specified menu item.

Parameters​

ParameterTypeDescription
menuItemMenuThe 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")