[View]  [Edit]  [Lock]  [References]  [Attachments]  [History]  [Home]  [Changes]  [Search]  [Help] 

[m8n] pi

LUA was already installed on my Raspberry Pi.
I verified this by just typing:
rpi/~:lua

Uploaded Image: alert.gifThe JIT version of the Lua VM is also already installed; you can verify evaluating
rpi/~:luajit

In case you need to install Lua, you should try:
sudo apt-get update
sudo apt-get install lua5.1

Note that other/newer versions of Lua are available as well.

If you need networking support, install the library with:
sudo apt-get install lua-socket

Other libraries can be found with:
apt-cache search '^lua-.*'


How to run S8 console platform (m8n)


Uploaded Image: alert.gifIf you have a snapshot file (e.g. s8.snapshot.lua) try the command
luajit -i s8.snapshot.lua

How to continue from this point?

The m8n console platform includes all you need to build snapshots and implement modular S8 systems in any device m8n can run, to be executed later on a raspberry pi device (or any other host where S8 runs).
You can fileIn/load any S8 framework in your device as usual, from local files, from U8 service folders and/or code downloaded from the network.

How to load and use Lua Socket Network support?

  1. Start S8 console
    luajit -i m8n.lua
  2. Load our luasocket framework (downloadable from U8 service)
    dofile("s8/library/luasocket.st.lua")
  3. Ready to evaluate in the console:
    print(smalltalk.DNS:gethostname())
  4. Browse LuaSocketObject and subclasses to learn how to use the framework
    Documentation pages has examples of use in Lua.
    There are examples using S8 in luasocketExamples.st and SimpleTHHPServer.st (see s8/library folder under console platform files)

How to connect remotelly?

  1. Start S8 console
    luajit -i m8n.lua
  2. Load luasocket framework
    dofile("s8/library/luasocket.st.lua")
  3. Load SystemServer framework
    dofile("s8/library/systemServer/SystemServer.st.lua")
    And the required files (luasocket.st.lua SimpleHTTPServer.st.lua SimpleJson.st.lua) to run the SystemServer
  4. Start the server
    smalltalk.SystemServer:start()
In case of running in a console window, you can run the server (until the server is closed) with
smalltalk.SystemServer:current():run()

To stop the server remotelly, you can evaluate the expression "SystemServer current close"
If runnning in a loop (e.g. rendering/game engine) you can evaluate a server step on each round with
smalltalk.SystemServer:current():step()

More resources on Raspberry Pi and Lua