world.Menu

MUSHclient script function (Method) — introduced in version 4.64

Creates a pop-up menu inside the command window

Prototype

BSTR Menu(BSTR Items, BSTR Default);

Data type meanings

Description

This creates a pop-up menu inside the command window. This is intended to let you have context-sensitive items (or helpful reminders of MUD comamnds).

Items: A string containing the menu items to be displayed, see below.
Default: If provided, this item is selected.

The Items parameter is a string, containing the menu items to be displayed, separated by the "|" character. Leading and trailing spaces are removed from each item.

For example: Item = "Take|Wield|Drop|Equip"

There must be at least one item, or an empty string is returned.

The return value is the selected item, if any. If no item is selected (ie. the menu is dismissed) then an empty string will be returned.

Lua example

-- make Ctrl+F2 show various options, and paste into command window

AcceleratorTo ( "Ctrl+F2" , 
                'PasteCommand (Menu ("chat|yell|ask|say"))', 
              sendto.script) 


-- display all functions
result = Menu (table.concat (utils.functionlist ( ), "|" ))

Lua notes

The Default parameter is optional and defaults to the empty string (ie. no default).

Return value

If there was an error condition as described above, the empty string.

If the menu was dismissed, or no item selected, the empty string.

Otherwise, the text of the selected item, with leading and trailing spaces removed.

Related topic

Utilities

See also

FunctionDescription
WindowMenuCreates a pop-up menu inside a miniwindow