A menu table - be it in the
menus table or dynamic - must have a
title item that determines the title, an
items table which determines the menu items and which has tables of the following format in it:
1
{ButtonText,ButtonDescription,ButtonFunction}
Remember, the script only supplies the player ID of the player who pressed the button.
Thus, a menu table should look like this:
1
2
3
4
5
6
{
	title = "Test Title",
	items = {
		{"Test Button","Test Description",function(id) msg2(id,"Test successful!") end}
	}
}
Menus are opened by means of the
unimenu function. It has the following arguments:
id - player ID to open the menu to.
number
construct - construct the menu anew or use the cached version?
boolean
m - menu to show.
table/number/string
p - page of the menu to show.
number
The most versatile and important argument is m.
Specify a dynamic menu table to open a menu out of that
Specify a
menus table index to open a menu out of that
Specify the string "current" to open the currently opened menu
If you have a menu that is extensive but does not change, specify
false as
construct, so the script wouldn't construct a menu anew, but open the cached page.
Other variables include:
pmenu [table] - a table containing the last opened menu of each player (1 layer -
pmenu[id])
spages [table] - a table containing actual menu strings for each page of the menu opened by a player (2 layers -
spages[id][page])