MENUITEM


menuitem( index, [label], [callback] )
index A number (1-5) for the order of the menu item in the pause menu.
label (optional) A string up to 16 characters long that will be displayed in the pause menu.
callback (optional) A function that will be called after the menu item is clicked.

This function will add or remove additional options in the Pause Menu of the game. You can add up to 5 additional items in the menu.

This is the default pause menu (press "P" on the keyboard, or start button on a controller while a game is running):

This is an example adding all 5 slots in the pause menu:



Examples:
menuitem( 1 , "item 1" )

- add new menu item at the top-most slot of the pause menu, under "continue" labeled "item 1"

menuitem( 3 )

- remove the menu item at slot 3

menuitem( 2, "invert Y", invert )

- add a menu item at slot 2, with the label "invert Y" and call a function named "invert" when clicked

menuitem( 5, "difficulty: "..diff, change_mode )

- add a menu item at slot 5, with the label "difficulty: ___" using a variable named "diff", and run the function named "change_mode" when clicked.



621

20 Oct 2023

Font