Lumail - The console email client


Lua primitives: on_complete()

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

If you define the function on_complete() it will be invoked when the user attempts to use TAB-completion within the input-prompt.

(When the user is prompted for input it will mostly be as a result of the prompt() function being invoked. The TAB-completion function is wired into this function.)

The on_complete() function is expected to return a table to the caller. The values of any keys will be presented as possible completion-options.

The standard on_complete() function will attempt to complete user-defined functions:

--
-- This function is called at run-time when tab-completion is invoked.
--
-- Any table values returned will be used in the completion.
--
-- Here we add any defined function the user might have written to the
-- completion set.  This works because Lua uses the global "_G" table to
-- store functions, etc.
--
--
function on_complete()
   ret = {}

   for k,v in pairs(_G) do
      ret[k] = k
   end
   return(ret)
end

Availability

This function has been available since version 0.10.

See Also

See also completion_chars, on_exit, on_idle, on_key, on_read_message.