Lumail - The console email client

Lua primitives: on_key()

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

If you define the function on_key it will be called when the user presses any key.

Keyboard bindings are generally setup via the keymap table, but it might be useful to allow processing to happen via Lua too.

For example:

function on_key()
  if ( k == "x" ) then
     msg("The user pressed 'x'" );
     -- The key was handled.  Don't do our keymap lookup
     return 1;
     -- continue processing.
     return 0;


This function has been available since version 0.07.

See Also

See also completion_chars, keymap, on_complete, on_exit, on_idle, on_read_message.