Module shell

Task providing an interactive shell.

This is a interactive shell that allows a user to connect to the Lumen scheduler, and maintain a Lua session. To connect, use telnet to the service's ip and port. Besides running lua code, the user have some helper syntax: If a line starts with a "=", it is equivalent to a "return ..." If a line starts with a "&", the following code will run in a background task. If a line starts with a ":", it is equivalent to a "return ...", filtered trough a simple pretifier (usefull for checking tables). This module depends on the selector task, which must be started seperataly.

Usage:

    local server = require 'lumen.shell'
    server.init({ip='127.0.0.1', port=2012})
    

Functions

new_shell () Returns a shell object.
init (conf) Start the server.

Tables

shell_env The environment for the shell.
conf Configuration Table.


Functions

new_shell ()
Returns a shell object. This is useful if you want to handle an interactive session on you own, not trough the integrated server.

Returns:

    a shell object
init (conf)
Start the server.

Parameters:

  • conf the configuration table (see conf).

Tables

shell_env
The environment for the shell. When starting a new shell session, it's environment will be initialized from this table. By default, it includes everything from _G plus the fields listed below. If you want something else, change this table.

Fields:

  • sched A reference to the Lumen scheduler library
  • ps A function that prints a human readable tasks list
conf
Configuration Table. This table is populated by toribio from the configuration file.

Fields:

  • ip the ip where the server listens (defaults to '*')
  • port the port where the server listens (defaults to 2012)
generated by LDoc 1.4.6 Last updated 2021-07-05 12:15:43