Lumail - The console email client

Lua primitives: choose_string()

NOTE: Lumail-legacy has been superseded by Lumail 2.x, which has a wholly unified Lua API.

The choose_string function allows you to prompt the user to make a selection from a small number of possible options.

It is primarily designed for our TAB-completion code, but due to its flexible nature it can be used for building simple menus, selecting signatures, or GPG keys, for example.

For example:

choice = prompt( "Depeche Mode", "Curve", "Prince" );
msg( "You entered: " .. choice );

The function expects to receive an array of choices, and will return either the string chosen or "" if the user cancels the menu without choosing anything.

TAB and the arrow-keys may be used to highlight the desired choice, and the selection is confirmed via RETURN, or canceled via Esc.


This function has been available since version 0.18.

See Also

See also prompt, prompt_chars, prompt_maildir, prompt_yn.