• Announcement: Lua.org now officially recommends this forum as a meeting place for the Lua community

RISC OS RiscLua's differences (1 Viewer)

As Sorn has kindly put links to RiscLua on the Lua page of the forum I thought I might briefly say something about it, and how it differs from standard Lua. The intention behind it was to provide a programming language with all the modern features of Lua, which could also be used like BBC BASIC to interact with RISC OS so that one could write wimp programs. I will not go in to the details that are specific to RISC OS here, except to mention that BBC BASIC uses operators ?, ! and $ for poking and peeking bytes, words (4 bytes) and strings respectively. The RiscLua equivalents for the BBC BASIC expressions ?x%, !x% and $x% are ?[x], ![x] and $[x], which should be easy for users of BBC BASIC to take on board. This meant, unfortunately, some savagery with lctype.c to change some attributes in the character table. I took the opportunity to make RiscLua parse hard spaces (ASCII 0x0a) as ordinary spaces, because there is nothing worse than finding that an invisible typing error is preventing your program from running. At the same time, llex.c was modified so that a backslash (\) was an abbreviation for the function keyword, and => was an abbreviation for return. This is a purely personal tweak. It makes
 curry = \ (f) => \ (x) => \ (y) => f (x, y) end end end
somewhat snappier. I used Dave Hayden's version of Sven Olsen's compound assignment operator patch to lparse.c so that a binary operator followed by an equal sign (=) updates: thus x & = y is equivalent to x = x & y.
Finally, and of greatest convenience, I used Sven Olsen's modification of Peter Shook's patch of lparse.c so that
local x, y, ... in table_expr
is equivalent to
local t = table_expr
local x, y, ... = t.x, t.y, ...
This cuts out a lot of verbiage.