lia.menu
Entity menu manipulation.
The menu
library allows you to open up a context menu of arbitrary options whose callbacks will be ran when they are selected
from the panel that shows up for the player.
Functions
add(options, position, onRemove)
Adds a menu with the provided options.
Parameters
-
options
Table
Table containing the menu options
-
position
Vector
Position of the menu (either a vector or an entity)
-
onRemove
Function
optional
Callback function to execute when the menu is removed
Returns
-
any
The index of the added menu in the
lia.menu.list
table
drawAll()
Draws all menus currently active on the screen.
getActiveMenu()
Retrieves the index and the choice of the active menu, if any.
Returns
-
any
Index of the active menu in the
lia.menu.list
table, and the chosen option
onButtonPressed(menu, callback)
Executes a callback function when a menu button is pressed and removes the menu.
Parameters
-
menu
String
Index of the menu to remove
-
callback
Function
Callback function to execute
Returns
-
any
True if a callback was provided and executed, false otherwise