Menus
Built-in, configurable menu that uses keyboard inputs.
Methods
CreateMenu(entries, title, closeCB)
CreateMenu(entries, title, closeCB)
Creates and returns menu
object.
entries* (table) - Table of menu entries (see below for structure)
title (string) - Visible title of the menu
closeCB (function) - Function which is called once the menu is closed
* = required arguments
Example:
local menu = FOM.CreateMenu({
{ {text = "Option 1"}, {text = "Option 2"} },
{ {text = "Print something", func = function() print("something") end} }
}, "Example Menu", function()
print("This example menu was closed")
end)
menu.open()
menu.open()
menu.open()
Opens a previously created menu. Takes no parameters.
menu.close()
menu.close()
Closes a previously created menu. Takes no parameters.
menu.visible(text, visible)
menu.visible(text, visible)
Changes the visibility of one menu line that matches the specified text
text* (string) - The text of the menu line to change visibility of
visible* (boolean) - The visibility of the text
* = required argument
Data Types
Menu Entries Table
The whole table represents the whole menu with each entry in the table being a new line in the in-game menu.
Each entry in the Menu Entries Table
list represents an option in the table. Each option can be navigated using the left and right arrow keys. Each entry is an entry which has the following keys:
text* (string)
func (function)
* = required entry
See example use of Menu Entries Table
above under the CreateMenu
method.
Reference: utils/cl_menu.lua
Last updated