LuaCmd The Lua Commander Version 1.0 |
Lua Commander is a 3 in 1 application/library for Lua programmers. It is composed by a Console, a Notepad and a Debugger.
The Console receives every print or error output. It also has a command line where you can type Lua based commands and other sugars.
The Notepad is a simple text editor or string editor, NOT a text FILE editor. But you can load text from files and save it to files. It will not keep the file name.
The Debugger is an interactive Window based debugger for Lua. It shows the source code been executed, together with the Call Stack and Local Variables Watch. You can set breakpoints, step into/over/out functions, stop everything, an even animate the execution steps over the code.
The Console source code is independent from the other two, and the two are dependent only on the Console. All the 3 parts were written in C, with no auxiliary Lua files, so there are very few registered functions in Lua.
It uses 2 libraries: Lua (of course) and IUP. IUP is a portable user interface toolkit developed at Tecgraf, but it is copyright Petrobras, one of our partners. So if you download the source code probably you will not be able to compile it. But IUP, as other libraries, soon will be available with a binding for Lua. More information about IUP check the online manual at http://www.tecgraf.puc-rio.br/manuais/iup (in Portuguese). In UNIX, IUP uses the Motif libraries, so you will need them installed on your system.
To minimize this limitation with the source code, the application is capable of dynamic loading a C library. As an example we distribute together with the binaries the LuaLib shared library and its .LUA that dynamically registers the library. Check the LUALIB_REG.LUA file for the Lua command. You just have to pass the file name and its initialization function as parameters.
The source code is split in a library and in an application. The library is more useful than the application it self because you can embed it in your own application do add a Lua debugger or a Lua console output. But in this case the application interface must be done using IUP. We are studding ways to contour this situation.
05 May 2000 - Version 1.0.
Known Problems
Some times the debugger state is corrupted and even when inactive pauses every dofile or dostring, but if you step it goes all the way, very strange. I am trying to track this, It does not happen often.
The multiline control used in the Debugger and in the Notepad does not have some functionality we desire. So I can not catch mouse clicks and I can not update the text without moving to the top of the file. We are working on solutions for these restrictions to improve LuaCmd interface.
Some Ideas
Global Watch: just like the Local Watch, but you can manually insert and remove global variables that are updated every step. You can do some of this using the console, but it will be nice to have this feature.
Breakpoints: a better breakpoint management with support for conditional breaks, temporary breaks (ex: run to cursor). Today we do not check if a breakpoint is at a valid line, but using part of the code of LuaC we can write a function that can filter invalid breakpoints at lines that never will have a line hook call.
Table Print: if you use a "parent" index in a table to implement object oriented support the print out of a table can have many non interesting levels. The print function can has a mechanism to check for a reserved word such "parent" in a table print out and do not print its contents.
Lua Tools: We can create a new dialog for the Lua Commander called Lua Tools, where LuaC and ToLua will be available.
Profile: the debugger can have a new state called profile that does not debug, instead it profiles the time for a function to execute. (Any Volunteers?)
LuaShell: the console can be used to implement a simple shell interface in Lua. (mkdir, remove, move, copy, list, attrib/chmod, find, where, ...) (Any Volunteers?)
Some Wishes
Multiple File Editor: a string editor is too simple. A multiple document manager with support for many open files in multiple windows is not so hard to do, but a really good text editor can be. Maybe It is more convenient to use an external editor such VI, EMACS, Word, TextPad, UltraEdit or Notepad. Probably this will be the main window of the Lua Commander.
Stdout/Stderr: I would like to redirect the output from stdout/stderr to the console window, but this seems to be impossible or near that. This affects the LuaLib write function that can be used with no file specified and it will write to stdout.
States: Since you can debug different scripts in the same Lua Commander section. Some functions to reset Lua state to the application initial state would be very interesting. Maybe also some general sate management.
If you interested in help, send comments, critics, suggestions, etc to me. Please, specify platform, compiler, version you are using in your message. And I'm far from been a Lua expert...
Looking for Lua? http://www.tecgraf.puc-rio.br/lua.
But remember: This program is free for every usage. The source code is public available, but the libraries used are copyright their authors and IUP is not public available. The author does not offer any guaranties, nor support, etc...
This work was developed at Tecgraf/PUC-Rio and home under my own motivation, but with help and support by many friend and colleges. I would also like to thanks lhf, roberto and celes for the offline help and support using Lua.
Antonio E. Scuri (messages to scuri@tecgraf.puc-rio.br, home page in Portuguese at http://www.tecgraf.puc-rio.br/~scuri).
See the Copyright Notice, is the same copyright used by Lua.
The program source code, HTML pages and tests, and pre-compiled binaries (including IUP and Lua dynamic libraries):
luacmd10_Linux.tar.gz,
luacmd10_Solaris.tar.gz,
luacmd10_IRIX6.tar.gz,
luacmd10_Win32.zip
This home page should be at http://www.tecgraf.puc-rio.br/~scuri/luacmd. This manual works only in Netscape 4 or above, and Internet Explorer 4 or above because of the JavaScript 1.1 code used.
There is a printable version of this manual in Adobe Acrobat (LUACMD.PDF 1Mb).
This manual was created using the manual toolkit ManJS, that can be found at http://www.tecgraf.puc-rio.br/~scuri/manjs.
.. "Make it Reusable, Make it Simple, Make it Small" ...