Starting
wow.png

!rlua84.png

RiscLua is available from here, in two versions: one suitable for the Raspberry Pi and modern platforms, the other, RiscLua (old) for older equipment. For the former you will need some auxiliary software in order to run it. If you do not already have it, you will need !SharedLibs. You can get this by clicking here which will download a zip file. If you open this with !SparkFS you will see a directory called Resources, and inside that an application !SharedLibs, having this icon.

!sharedlibs.png

Copy this into $.!Boot.Resources. Now do the same with this , dragging the !SharedLibs from the Resources directory in the zip file over your !SharedLibs in $.!Boot.Resources. You will also need two modules: the ARMEABISupport module and the Shared Unix Library module. If these are not already in $.!Boot.Resources.!System.400.Modules and $.!Boot.Resources.!System.310.Modules respectively then you can get them from the zip files downloaded by clicking here and here.

You can put !rlua wherever is convenient on your system. When run, it puts its icon on the iconbar, sets up some commands and system variables, and defines the Lua filetype.

file_18c.png

If you put !rlua in $.!Boot.Choices.Boot.Tasks then RiscLua will be ready to be used, with its icon on the iconbar, at boot-up. Click Select on !rlua's iconbar icon and you will see the Utilities directory

Open the Utilities directory and doubleclick

taskw.png

This will put !TaskW's icon on the iconbar. This convenient utility executes in a taskwindow any program (e.g. BASIC, Lua, ... ) whose icon is dragged onto !TaskW's iconbar icon. For example, download the Examples directory and drag the RiscLua program collatz onto it. A taskwindow will open inviting you to enter a number. Let us try entering 12 then pressing RETURN.

content3

Can you see what is happening? Each number n is replaced by n/2 if it is even and 3n+1 if it is odd. The Collatz Conjecture states that, if you start with a positive whole number and repeatedly replace them using this rule, then you must eventually reach the number 2 and hence 1 in the next step. The Conjecture has not yet been proved. To see the RiscLua program itself SHIFT-click on the file collatz . We will leave till later what the program means, but you may recognize some familiar words and symbols.

If you write a RiscLua program using your favourite text editor, and save the file with type Lua , then double-clicking on the file's icon will execute the program. This is just as you would do with BASIC. The text of the RiscLua program is first compiled to bytecodes , instructions for the Lua virtual machine, which are then executed. The !Compile tool in the Utilities directory

compile.png

will convert a textual program into a bytecode file, which can also be executed (slightly faster because the compilation stage has already happened). Bytecode files are harder to read, of course. In practice the compiling stage is so quick that there is little point in using !Compile separately.

There is another way of using RiscLua programs if you use the StrongED text editor. This way is usually referred to as scripting. Along the top of a StrongED window is the smarticonbar, and on it the Apply icon.

Apply.png

SHIFT-dragging a Lua program onto it will alter the text in the window. CTRL-dragging will leave the window unchanged but open a new window containing the altered text. The program reads the text as if it were in a file whose pathname were in the variable

           arg[1] 
and the output of the program is the altered text. If you do not have StrongED you can still do scripting using this tool in the Utilities directory.
nostred.png