Home  Contents

event:shell

Event Core4 Lua Event System

SYNOPSIS

shell = app:shell([stdin[, stdout[, stderr]]])

DESCRIPTION

Create a interactive embedded Lua shell, running inside the current application.

An embedded Lua shell allows a user to run Lua commands just as if a stand alone Lua interpreter would be running. The entered commands, however, run within the current application. This gives interactive access to all global variables of the running application, which is helpful for debugging.

By default, the embedded shell does it's input output via the standard channels inherited from the Lua process it runs in. Alternatively, file descriptors may be specified for each stdio channel.

The embedded shell is implemented using the event loop mechanism and will only work as long as an event loop is running.

RETURN VALUE

An embedded shell instance. The returned instance has a single function: shell:close(), which stops and discards the shell.

NOTES

Since the Core4 kernel does not have line editing capabilities, we recommend using QCoscom in Readline mode for accessing the embedded shell.

BUGS

Overrinding stdio channels is not complete. The Lua io library always routes to the default stdio channels. Only the commands print() and echo() know about stdout overrides.

EXAMPLE

>  > 
app = event.new() shell = app:shell()
Lua 5.1.4-Core4 [EMBEDDED] Copyright (C) 1994-2008 Lua.org, PUC-Rio

SEE ALSO