lua-users home
lua-l archive

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


Hi,

When I imagine LuaOS I assume there is no mention of Java whatsoever.
I understand the Java dependency is only for the GUI examples but it
would be cool if LuaOS was like the early Linux where you used for any
hardware lying around.

I imagine/dream using all this Android hardware with only the Linux
kernel/drivers plus something like LuaOS but with also some GUI
capabilities (but not Java, please!)


On Wed, Aug 24, 2011 at 9:02 PM, Stefan Reich
<stefan.reich.maker.of.eye@googlemail.com> wrote:
> Hey folks.
>
> A new release! This is really beginning to be fun. You can now write
> actual Swing-based GUI apps in (Safe) Lua.
>
> Here goes:
> http://luaos.net/luaos-0.6.php (for Windows + Ubuntu as per usual)
>
> As an appetizer, check out this little script:
>
> -- Show the Lua OS example scripts in a list
> -- and allow user to run any of them
> -- Uses a Java Swing GUI!
>
> gui = safecomm.invoke{'gui', 'getMasterObject' }
> frame = gui:showFrame('Lua OS example scripts. This is a Lua app!!')
>
> -- Notice how we seamlessly create Java objects and call Java methods:
>
> list = gui:newList()
> vector = gui:newVector()
> scripts = gui:getExampleScripts()
> size = scripts:size()
> for i = 0, size-1 do
>  vector:add(scripts:getName(i))
> end
> list:setListData(vector)
>
> btnRun = gui:newButton('Run example')
>
> -- We can even do callbacks (call Lua objects from Java):
>
> actionListener = object()
> function actionListener:run()
>  local idx = list:getSelectedIndex()
>  if idx >= 0 then
>    scripts:runScript(idx)
>  end
> end
> btnRun:addActionListener(gui:actionListener(actionListener))
>
> buttons = gui:newPanel()
> buttons:setLayout(gui:stalactiteLayout())
> buttons:add(btnRun)
>
> -- This is a very nice and useful little layout manager I once made
>
> layout = gui:letterLayout('LLB')
> layout:setBorder(10)
> frame:setLayout(layout)
> frame:add('L', gui:newScrollPane(list))
> frame:add('B', buttons)
>
> -- Stay alive while user does things
> safecomm.daemon()
>
> ...and that's all already. :)
>
> I did some timing measurements and we get about 1 ms per roundtrip -
> that includes socket transfer to Java, going to the Swing thread,
> transferring stuff back to Lua and tunnelling sandbox barriers. Pretty
> decent I'd say and certainly quick enough for now.
>
> A note on security: The sandboxes are probably not tight at this point
> as the comm infrastructure has not been audited. But the goal now is
> to get stuff to actually work - super-security will come at a later
> time.
>
> Enjoy!
> Stefan
>
>