lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


This new stable build of lua4nt (v 0.1) corrects a few shortcomings of
the previous version. It now:

* supports Ctrl-C/Ctrl-Break to terminate a running script

* supports command-line redirection for stdin, stdout and stderr

* includes further small changes

The way the command-line redirection is done is probably not overly
clean; surprisingly, Lua, despite being an extension language, has no
simple facility to dynamically switch std* files. Hints as to how to do
this in a clean(er) fashion are welcome.

The source code for lua4nt is in the public domain.

---- copied from the previous announcement ----

lua4nt is a plugin dll for the JPSoft command-line-processor family
(4NT/Take Command). lua4nt.dll contains the whole of the standard Lua
distribution (5.1.3, plus lhf's token filter code) as well as the glue
code required to bind the whole lot to 4NT/TCC. See the 4NT/TCC command
'plugin' for details of how to load/unload plugins.

The plugin implements just three items:
  _luaver returns a string with the Lua version.
  @lua[...] evaluates a string as Lua code and returns the result.
  ilua ... executes a script file or initiates an interactive session.

Using a plugin has a couple of advantages: it executes scripts faster as
the interpreter is already up and running; it also allows editing of
interactive sessions with all of 4NT's command-line-editing
capabilities.

Obviously, as the interpreter is loaded only once upon startup, it will
keep state between evaluating strings and running scripts. This
shouldn't be too much of a problem, just keep in mind that global
variables et cetera may already be initialised from a previous run.

The zip file contains the dll, the glue source code, the necessary
header and library files to recompile (sans the Lua source files) and a
tiny example.

Download: http://thomaslauer.com/download/lua4nt01.zip

(Note 1: I backported this code from a slightly more elaborate version I
did for Idle. I've tested the Idle version quite a bit and I'm using it
on a daily basis, so I am pretty confident that the Lua version is
stable as well. However, I have not used the Lua plugin very
extensively, so YMMV. Comments and bug reports are welcome.)

(Note 2: There is a free (as in beer) basic version of the JPSoft
command line processor called TCC/LE. See their website for details and
downloads: http://jpsoft.com ).

-- 
cheers  thomasl

web: http://thomaslauer.com/start