Version 13 of Lua

Updated 2004-03-07 14:38:41

Lua [L1 ] is one of the many languages with a Tk binding. A vaguely C-styled OO scripting language developed "half-open source" at a Brazilian institution, characterized by using hash tables as central data structure, even for vectors and lists. Lua's kernel is unusually compact. Lua style emphasizes metaprogramming.

Roberto published the Lua book [L2 ] early in 2004.

Lux [L3 ] is Jean-Claude Wippler's experiment at binding Lua together with more traditional scripting languages ...

Max Ischenko reports success using SWIG to wrap Lua libraries as loadable .so-s exposed through Tcl. He even has an incr Tcl class he calls "LuaInterpreter".

mfi: Yup, that was pretty simple. To compile a .so you just do:

 swig -tcl8 -module lua Lua.i
 gcc -c -fpic lua_wrap.c
 gcc -shared lua_wrap.o -o lua.so -llua -llualib

And the abovementioned itcl class is a little more complex than this sketch:

 itcl::class LuaInterpreter {
        public {
                method doFile fname { return [lua_dofile $L $fname] }
                method doString buf { return [lua_dostring $L $buf] }
                method call {func {arg ""}} {}

                method popLast {} {
                        set value [lua_tostring $L -1]
                        lua_remove $L -1
                        return $value
                }
                method printStack {} {}
        }
        constructor {} {}
        destructor { lua_close $L }
        common call_template "return %s(%s);"
 }

 itcl::body LuaInterpreter::constructor {} {
        set L [lua_open 1024]
        L doString "function _ERRORMESSAGE(msg) print(msg) end"
 }

 itcl::body LuaInterpreter::call {func {arg ""}} {
        set op [format $call_template $func $arg]
        doString $op
 }

I found the interface of doString, call and popLast quite sufficient for my needs. Notice also, that you can have as many instances of Lua interpreter as you want. --mfi.


Lua is quite fast: http://www.bagley.org/~doug/shootout/ but doesn't seem to have all the nifty features that other languages do.


CL sometimes collects Lua references [L4 ].


Category Language