Skip to content

Menu : List

This is the menu class. It provides a horizontal menu bar with selectable items. Menu items are displayed in a single row and can have custom colors and callbacks.

Properties

PropertyTypeDefaultDescription
separatorColorcolorgrayThe color used for separator items in the menu

Functions

MethodReturnsDescription
Menu:setItemsMenuSets the menu items and calculates total width

Protected Functions

MethodReturnsDescription
Menu:initMenuInitializes the Menu instance
Menu:mouse_clickbooleanHandles mouse click events and item selection
Menu:render-Renders the menu horizontally with proper spacing and colors

Sets the menu items

Parameters

  • items table[] List of items with {text, separator, callback, foreground, background} properties

Returns

  • Menu self The Menu instance

Usage

lua
menu:setItems({{text="File"}, {separator=true}, {text="Edit"}})
menu:setItems({{text="File"}, {separator=true}, {text="Edit"}})

Released under the MIT License.