Prerequisites: Lua 5.1.4 on Windows (tested) or Linux (as of yet untested). Java 6 for the GUI part.
Safe Lua is approaching the functionality of an actual operating system! There is now a task manager that shows you what is going on in the sandboxes - and allows you to create and delete sandboxes safely.
The task manager consists of a Lua backend and a Java frontend. (So you also need Java 6 to run this.)
First, start the Lua backend:
cd taskmanager lua taskmanager_cage.lua
Then the GUI:
java -jar LuaTaskManager.jar
And then: Have fun!
safedir lists all .slua (Safe Lua) source files in a directory - and runs them for you and gives you a snippet of their output. As everything is safe, they can't crash your machine or do anything nasty (at least we hope so). The scripts can't even produce an endless loop (we tested that).
For starters, try:
lua safedir.lua examples
This constructs a Safe Lua cage with four sandboxes in it. Try:
cd examples lua an_example_cage.lua
Oh those GUI toolkits! I tried wxLua and it drove me crazy. Next up was VCLua which worked at least a little better.
To run the example, install VCLua 0.3.5 and put vcl.dll or the corresponding Linux library in an appropriate path. For simplicity, I'd say just copy it into the 'gui' directory and you're good. Then, just run:
cd gui lua vclgui_cage.lua
It will display a frame with a button. When you press the button, its caption should change - but there is a weird problem (bug?) in the way VCLua interacts with coroutines and unfortunately I couldn't get the event handling to work properly yet. So no caption change. But at least it doesn't crash. And you get to see something! There is quite a bit of Safe Lua magick at work in there, so I'm quite proud about that.
Yes, you read that right: I got the Java GUI toolkit to work with Safe Lua. They talk to each other through a nice little socket interface. Isn't that something?
Obviously, you need Java 6 to make this work. Nothing else required though. First, start the server:
cd gui java -jar GUIServer.jar
Then the Safe Lua client:
cd gui lua javagui_cage.lua
Pressing the button has no effect here either as event passing was just a bit too complicated to get it done in this iteration. When we settle for a toolkit we like to use, we'll have time and reason to cram all the advanced stuff in there.
The beautiful thing, anyway, is that the hello world app itself never changes, no matter with GUI bridge you use. You'll see that when you look at the sources. Which you should do. They're instructive and I added a lot of comments and dressed them up for the occasion.
-S