Lua logo
RiscLua version history
RiscLua download page
Lua for RISC OS
Notes on the sources
Programs written in previous versions of RiscLua that use SWIs will need some rewriting to run under RiscLua 5.00. I apologize for this. RiscLua has always been something of a testbed, and the long periods during which RiscLua was stable are the result not so much of consideration for users as of my own lack of application. The interface between Lua and RISC OS has been a compromise between different paradigms. RiscLua 5.00 draws the boundary closer to RISC OS, and packages it into a single library called riscos, which provides symbols dim, !, ?, $ and sys, so that the syntax of RiscLua 5.00 is now much closer to that of Basic. This should make it much easier to convert Basic programs naively to RiscLua programs, as a first step, to be refined in later steps by using Lua's greater facilities for abstraction.

Because the memory allocated by dim is not garbage-collected, unlike the memory allocated in previous versions of RiscLua, it is no longer appropriate for such allocations to be made in software libraries; they must be made at the top level. So library functions that need allocated arrays should now have an extra parameter for them. This leads to a more Basic-like style of programming for dim-statements.

In Basic strings are stored as arrays, and string arguments to SYS are converted to pointers to the array. In Lua strings are stored quite differently. So beware that sys does not accept strings as arguments. You must explicitly store the strings in allocated memory. I suggest a convention like this:

    title$ = dim (title.."\r")
which converts a Lua string into a pointer to an array holding a string terminated by a carriage return.

The example application !Eph is a RiscLua version of Acorn's application !Msg which puts an ephemeral message up on the screen. If you happen to have it you may find it instructive to compare the two !RunImage files, one in Basic and the other in RiscLua. The RiscLua version is more modular.

Back to RISC OS stuff