Lua logo
RiscLua download page
Lua for RISC OS
Compile it yourself
Notes on the sources
Lua (version 3.2) was first ported to RISC OS by Reuben Thomas, who has since, alas, left the RISC OS scene. Soon afterwards Lua version 4.0 came out, at which point I started experimenting with the Lua sources to see if I could add to them facilities for calling RISC OS SWIs. In that way RiscLua started life. Its initial development was rather haphazard.

I was faced with two problems. First, the standard Lua sources use 64-bit floating point numbers (doubles) by default. Unfortunately the ARM chips mostly used by RISC OS did not then have on-chip floating point operations. The Lua sources have since been improved to make it easier to use alternative number types. My earliest efforts used the default doubles; later I used 32-bit integers as the default for RiscLua, reckoning that the sacrifice of not having floating point numbers was worth the efficiency gained on ARM chips. Later versions of RiscLua gave back the use of floating point numbers; first of all, version 3.10 used the MAPM bignumber package. This was abandoned as clumsy in version 3.20.

In version 4.00 the doubles library was introduced, which implements 64-bit floating point numbers, not in the Lua virtual machine (which keeps to 32-bit integers) but as objects in the heap. Second, RISC OS SWIs use registers as pointers to arrays of data, whereas Lua, for reasons of portability and security, avoids such things. However, its notion of userdata provided enough to implement what was required. It was not until version 3.00 of RiscLua, with the introduction of the block and swi libraries, that the RISC OS calling interface was properly rationalized. In version 3.30 bitwise operations on integers were implemented more efficiently using extra opcodes for the Lua virtual machine. Programs not using them should still compile to virtual machine code that is runnable on other platforms.

Version 5.00 reverts to an earlier, simpler approach. It replaces the block and swi libraries by the single library riscos and also moves into it the directory iterator and filetype functions formerly in os. The syntax is now much closer to that of Basic. Adopting Basic's confusion of addresses and pointers with integers is somewhat against the spirit of Lua, though the consequent insecurity will not affect pure Lua programs, only those whose use of SWIs requires the presence of buffers for passing data between program and operating system.

Version 5.30 is based on Lua 5.2(beta). It should run programs written for RiscLua 5.00; compiled programs will need to be recompiled. Version 5.40 is based on Lua 5.2. It is backwards compatible with 5.30 but makes dimed blocks garbage-collectible. After a statement   x = riscos.dim(n), a userdatum riscos.block[x] is created. Applying # to it yields the number of bytes in the block - useful for checking overflow. Setting it to nil renders the block garbage-collectible. Version 5.41 is based on Lua 5.2.1 and is backwards compatible with 5.40. Version 5.50 replaces the doubles library by the arbitrary-precision bc library. Version 5.60 is based on the final version of Lua 5.2.2 and version 0.12 of the Lpeg library. Version 5.70 adds the alternative syntax x op = y for x = x op y for the operations .. + - * / ^ % & | ^^ << >>. Version 5.71 uses LUA_INIT to add error throwback with a function riscos.throw if the DDEUtils module is available. Format strings can be used as if they were functions.

Version 6 is made possible by the release of GCC 4.7.2 which affords floating point hardware (for ARMv7) and dynamically loadable libraries. Thus RiscLua can now revert to much greater conformance with the standard Lua distribution. Numbers need no longer be restricted to 32-bit integers. The riscos, lpeg and bc libraries are now loadable dynamically and are not built in. The only difference for users is that old programs must be modified by the insertion of appropriate require statements.

6.3 May 2016
Corrected an obscure bug in the local .. in .. code. Compound expressions after the in no longer have to be parenthesized.
6.2 December 2015
Corrected an obscure bug in the drag library that eventually confuses the window manager. drag.init no longer exists.
6.1 December 2015
Catch-up version, built from Lua 5.3.2. Coercion between strings and numbers turned off. You must use tostring and tonumber.
6.0 October 2015
Compiled with GCC. Dynamic linking. Numbers can now be floats.
 
5.71 May 2015
Error throwback. (getmetatable "").__call = string.format
5.70 August 2013
Update operators added.
5.60 March 2013
The Lpeg library is updated to version 0.12 and the final version of Lua 5.2.2 is used.
5.50 November 2012
The doubles library is replaced by the arbitrary precision bc library, which uses no floating point instructions.
5.41 May 2012
Catch up version based on Lua 5.2.1
5.40 November 2011
Catch up version based on Lua 5.2. Blocks are now garbage-collectible. The riscos library has a table, block, of userdata indexed by addresses of allocated blocks.
5.30 July 2011
Catch up version based on Lua 5.2(beta). Backwards compatible with RiscLua 5.25, except that the escape sequence \* in strings has become \z.
5.25 November 2010
Catch-up version based on Lua 5.2(alpha). Backwards compatible with RiscLua 5.20 except for treatment of lexical environments and modules.
5.20 February 2010
Catch-up version based on Lua 5.2w2. Backwards compatible with RiscLua 5.00. Implements the features new to Lua 5.2 such as lexical environments.
5.00 December 2008
Revert to earlier simplicities - out with blocks - syntax for arrays, indirection and software interrupts now practically identical to Basic. Language now leaner but less safe.
 
4.14 June 2008
Can now subtract blocks to get offset. Added draw and weave libraries.
4.13 April 2008
Update Lpeg library to version 8.
4.12 March 2008
Update to Lua 5.1.3. Incorporate Lpeg library, version 7.
4.01 July 2007
Update to Lua 5.1.2.
4.00 December 2006
Update to Lua 5.1.1. Add doubles library.
 
3.41 April 2006
Update to Lua 5.1.
3.30 January 2006
Update to Lua 5.1(beta). Implement bitwise operations in the virtual machine.
3.20 October 2005
Update to Lua 5.1(alpha+). Use separate bit library for bitwise operations.
3.10 May 2005
Use mapm library for arbitrary size numbers.
3.00 August 2004
Major rewrite using block and swi libraries replacing riscos library. Improved error handling. Revert to implementing RiscLua as an application.
 
2.32 May 2003
Implement RiscLua as a relocatable module.
2.30 May 2003
Update to Lua 5.02.
2.20 December 2002
Update to Lua 5.0(beta).
2.10 November 2002
First 32-bit version.
2.00 October 2002
Update to Lua 5.0(alpha).
 
1.50 June 2002
Update to Lua 4.0.