Lua extensions and tools by XTG Systems    
... the best things in life are free ...

These are the extensions and tools we have developed for Lua programming language. All these things are free to use for anyone in both private and commercial environment.
  mod_lua apache module   just a very simple apache module which allows to run both pure Lua scripts (and bytecode files) and HTML files with embedded pieces of Lua code (similar to PHP).   Linux, Win32   Details
  titmouse editor/debugger   component (window-class) which can be used stand-alone or enbedded in your own application. It provides integrated editor and debugger (break-points, step into/over, variable inspection, expression evaluation) Win32 Details
  xtg_lua_lib function library   library with many useful functions present in other development enveronment we use (number, string, date, file and SQLdb functions) Win32 Details
XTG Systems home     Lua home     Scintilla home

mod_lua apache module

mod_lua is very simple apache module. It is compilable on Linux and Win32 platforms, it links to lua core and lualib statically. It can run both pure-Lua modules (source-code and byte-compiled) and HTML files with Lua source-code embedded in a way similar to PHP. Please consider this module to be more a demo of how this can be done although it surely can be used.

mod_lua will report both compile-time and run-time errors in a developer-friendly way to ease the debugging. The module provides two handlers, one for pure-Lua modules, the other for LHTML files (HTML with Lua source-code embedded within <?lua   ?> brackets).

mod_lua source code and binary releases can be found here: for RedHat 7, Apache 1.3.14 for Win32, Apache 1.3.19

Compilation on Linux: you need apache-devel package installed and Lua headers and static libraries liblua.a (core) and liblualib.a (lualib). Then just have a look at the Makefile which is included in the release. Be root and run make all. This should compile and install the module with the other Apache modules.

Compilation on Win32: you need MSVC6 and Apache binaries and sources installed, plus Lua header files and static libraries liblua.a (core) and liblualib.a (lualib). Then copy the source files (mod_lua.c, mod_lua_handler.c and mod_lua.h) into apache/src/modules/experimental directory and copy the project file (mod_lua.dsp) into apache/src/os/win32 directory. Open Apache workspace file and add the project mod_lua.dsp to this workspace and compile it. You will find module in the apache/src/os/win32/Release (or Debug) directory. You have to copy it by hand into apache/modules directory where the other modules reside.

Setting up Apache to use mod_lua:
(this applies to all platforms) You need to add three directives into httpd.conf to make it work.

LoadModule lua_module modules/

AddHandler lua-handler .lua
AddHandler lua-html-handler .lhtml
The first one will load the module into Apache.
The other two will attach the files with extension .lua to lua-handler and the files with extension .lhtml to lua-html-handler. Lua-handler is very simple, it just runs the file through lua_dofile function. Lua-html-handler works in a way similar to PHP, it parses the file source and leaves everything intact (sends everything out unchanged) until it finds the <?lua opening bracket. Then it searches for the closing bracket ?> and evaluates the contents like a Lua source code. Then it continues the same way until the end of the file.

Lua-html-handler itself registers two functions in Lua: print and import. Print function just takes all its arguments as strings and writes them out. Import function takes single string argument - name of the file. This name can be either absolute path (starting with slash(/)) or relative path. If the path is absolute it is not changed. If the path is relative, then the current path (web-page directory) is prepended. Then is called lua_dofile.

titmouse editor/debugger

Titmouse is integreated Lua editor and debugger. I have started working on it around Christmas 2000 and the goal was to make it easier to me and to my colleagues to work with Lua scripts. The idea was to be able to edit and debug the code in the same window in order to fix the bugs very easily and also to be able to work with several scripts at once. I have been very happy to find Scintilla editor component which has eased my task very much and which has become the core part of Titmouse. Scintilla is free source code editor with syntax highliting and other nice features, it supports Lua syntax highliting too, and it has some debugging features bult-in (eg. showing break-point and current line marks). I have wanted for Titmouse to be more a component than a stand-alone application, the object which could be used in other programs which need to provide Lua editing and debugging features to its users.

The name of the tool (titmouse) is kind of symbolic, those of you who know this bird will recall that it is very small and nice and clever one.

Currently you can download windows binaries only. These binaries contain the titmouse component embedded in a very simple application called xtgvdl (standing for XTG Visual Debugger for Lua) plus xtgluc.dll which is Lua interpreter enhanced with some dozens of functions which we find useful (ODBC connectivity, some number, string and date routines; the list of functions can be found here). Please view this as a kind of demo you can have a look at and play with a bit. I will release the sources and the binaries for the Titmouse component itself in a short time (there is some cleanup needed in the sources). This application can be freely used and the component will be free to use and develop under the same conditions as Lua itself.

There is no need to install the tool, just download the zip file, unzip it and run xtgvdl10.exe. Please keep in mind that this application is still in development and that it may contain some bugs.

Titmouse currently supports working with several files at once, Lua syntax highliting and indentation guides (thanks to Scintilla editor), setting break-points, syntax check, run to break, step over, step into, stop execution. You can set watches and inspect variables and expressions after step, break and at the script termination. Titmouse also prepared to support custom loading and saving of the scripts. This feature is intended for future use when it could be possible to eg. load and save the scripts from/into databases (we use SQL databases a lot). Debugging in xtgvdl can be controlled from keyboard completely which eases this task a lot.

titmouse and xtgvdl binary releases can be found here:

titmouse and xtgvdl screen shots can be found here:
tm01.jpg (editing, compilation error after check)
tm02.jpg (debugging session prepared to run)

xtg_lua_lib function library

Before I started working on the titmouse project, I had started working on support libraries which enabled us to use Lua. We are working with SQL databases a lot so we needed SQL connectivity and some data manipulation routines. We have developed several C/C++ tool libraries before for these tasks, so I have only exported some of these functions to Lua (with some modifications where needed). This gave us ODBC connectivity plus some dozens of number, string and date manipulation routines.

There is no release of this library avilable yet but it will be in a short time here. I have to do some function name clean-ups (current names are kept close to the functions of the other development tools we use) and some small updates. But you can give a try to titmouse in xtgvdl which currently contains all these functions bundled in xtgluc library and the basic documentation is included.

Last update: 2001-04-14 by Roman Vanicek (