lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


In message <alpine.LSU.2.00.0909221209330.23674@hermes-1.csi.cam.ac.uk>
you wrote:

> I think a first language needs quite a lot of batteries included, so that
> the teacher can provide fun motivating exercises. Graphics, sound,
> networking, hooks into the OS and/or apps (like AppleScript), etc.
>
> As a bare programming language I think Lua is great for teaching, but it
> needs a load of addons to provide a fun environment. What I would like is
> something a bit like BBC BASIC on the Master (i.e. with a full-screen
> editor as well as old-school line-by-line input).

You should try RiscLua 5.0 on a RISC OS machine. Its access to the OS
resembles that of BBC Basic on purpose, to make it easier for those
weaned on BBC Basic. The 'riscos' library in RiscLua has !,?,$,dim,sys
corresponding to BBC Basic's !,?,$,DIM,SYS, though the syntax in
RiscLua is rather cleaner. This makes a naive conversion from Basic
programs to RiscLua straightforward. The StrongED editor provides an easy
development environment, in which it is possible to write a Lua
program in one window and have it modify text in another - by
dragging onto an icon in the window's toolbar. The (imaginary) file
containing the text accessed as arg[1] and the new text is obtained
from stdout. For example

 #! lua
 for line in io.lines(arg[1]) do
   if not line:match "Basingstoke" then print(line) end -- if
 end -- for

will remove all lines containing "Basingstoke". So not much effort is
needed to produce programs that do things in the desktop.

The access to the OS makes RiscLua as usable on the Master's descendent's
as BBC Basic. It also has facilities such as iteration over objects in
a directory that Basic needed but never had.

-- 
Gavin Wraith (gavin@wra1th.plus.com)
Home page: http://www.wra1th.plus.com/