ChipmonkeyLua (for short: CMLua) is an interactive Lua interpreter in the spirit of vintage BASIC interpreters. It’s available for Windows, Linux 64 bit and Linux 32 bit operating systems and is a full Lua 5.2 interpreter. You can do most things as you can do with the original stand-alone Lua interpreter. However, CMLua comes with a lot of built-in features like a default graphical mode, easy file and input handling and mouse input. Bear in mind that CMLua uses a 16 bit colour mode. Colour values are valid from 0 to 65535. You can, however, use the built-in function hrgb (red, green, blue) to get a colour close to its 24 bit value.
There are three packages available according to your operating system:
CMLua needn’t to be installed, just unzip to a folder and double click. On Linux you might need to install “liblua5.2”. It is also possible to start CMLua from the console adding a few command line parameters, which are:
Add a second parameter as a default script which will be executed right after the start of CMLua.
You can load the scripts right in the interpreter with
load ("scriptname.lua")
After loading you can have a look at the listing with
list()
Use ESC to break the listing or SPACE to pause and any other key to resume. Then try
run()
to execute the loaded script.
For longer scripts I recommend using an external editor, e.g. Geany. For smaller and/or for testing purposes just type
edit()
Now you can enter your script. To quit edit mode leave a line empty and press return. If you have some longer algorithms to enter try switching in the hires mode for more characters per line with
hires()
There are a few built-in functions which you can see by typing
help()
You can get more help by typing the function with empty brackets, e.g.
sleep()
The answer will be
Usage: sleep (ms)
Since the keys are’nt accessable within CMLua, I mapped the German special characters (a.k.a. as “Umlauts”) onto the function keys.
The functions keys are still readable through getkey()
This is the start screen (in mode 800 x 600)
The result of the infamous plasma script
The plasma.lua script in hires mode
The yahtzee example (in German)
Handling images in CMLua format
There is a support forum on retrogamecoding.org
This is a very simple implementation. On Linux it tries to use an installed media player, on Windows it uses the mmsystem (which means that one can play only one wav at one time).
added:
You can now pause the display of listings or files by pressing “Space”. Any other key continues.