As Tcl/Tk became more popular, we began to hear people frequently remarking that although Tk is a versatile graphical user toolkit, Tcl isn't the kind of language that everyone feels comfortable with. On the other hand, the description of graphical user interfaces is a very natural use of Lua, a interpreted programming language that combines data description mechanisms with a simple, powerful, and extensible semantics.
TkLua allows programmers to access Tk widgets from Lua. It also offers the possibility of instantiating an OpenGL canvas, where users can draw images accessing the OpenGL functions, also from Lua. (If you don't have an OpenGL library installed on your machine and want one, you can use Mesa, a wonderful "3-D graphics library with an API which is very similar to that of OpenGL" developed by Brian Paul.)
Programmers can use the Lua API to embed the library in their programs. Another alternative is to use the tolua tool that automatically binds C/C++ code to Lua. So, one can write Lua scripts to build the interface and to bind users' actions, calling C/C++ functions if necessary. The OpenGL canvases can be accessed both from Lua and C/C++ code.
To implement the TkLua binding, we set ourselves a challenge: as far as possible, to keep Tk's philosophy, even widget names, attributes, and commands. Everyone knows how tempting it is to try to ``improve'' an existing API, but in the long run avoiding this is better for Tk users, so they do not have to learn new concepts. It's also better for us, because we don't have to write a new manual! Actually, we hope that these simple pages will be enough to explain how to use TkLua. Of course, you will have to look up the Tk manual pages for details. But if you know Tk and have experimented Lua for awhile, you will be writing sophisticated interactive programs in a few minutes!
TkLua is freely available by ftp. Fell free to use it, but use it at your own risk. Be aware that TkLua doesn't cover all Tk features. We have implemented the features based on our own need. If you miss any Tk feature you really need, let us know; it may be easy to include them. In fact, you will soon figure out that it is quite easy to extent and improve TkLua by yourself.
Suggestions/comments are also welcome.
The current TkLua version is 2.0. This version presents incompatibilities with older versions. In order to run Lua scripts written for older version, the distribution includes the file "tkcompat.h" that must be executed before interpreting them.