Skip to content

SaferLua Controller

Joachim Stolberg edited this page Jan 30, 2019 · 21 revisions

SaferLua Controller with Periphery

Table of Contents

SaferLua Controller

The SaferLua Controller is a small computer, programmable in Lua to control your machinery. In contrast to the SmartLine Controller this controller allows to implement larger and smarter control and monitoring tasks.

The controller can be programmed in SaferLua, a subset of Lua for safe and secure Lua programs, which can't damage or crash the Minetest server.

The controller has a menu form with the following tabs:

  • the init tab for the initialization code block (see Loops and Events)
  • the func tab for the Lua functions (see Loops and Events)
  • the loop tab for the main code block (see Loops and Events)
  • the outp tab for debugging outputs via $print()
  • the notes tab for your code snippets or other notes (like a clipboard)
  • the help tab with information to the available commands (see SL Controller Commands)

The controller needs battery power to work.

Battery


The battery pack has to be placed near the controller (1 node distance). The needed battery power is directly dependent on the CPU time the controller consumes. Because of that, it is important to optimize the execution time of the code (which helps the admin to keep server lags down :)) See Loops and Events or Examples

The controller will be restarted (init() is called) every time the Minetest server starts again. To store data non-volatile, a Server node is available.

Central Server

The Server node can be placed everywhere. It can also be used for communication purposes between several Controllers. The Server has a form to enter valid usernames for server access.

For special Server commands, see Server Commands.

SaferLua Controller Terminal

The Terminal is used to send command strings to the controller. In turn, the controller can send text strings to the terminal. The Terminal has a help system for internal commands. Its supports the following commands:

  • clear = clear the screen
  • help = output this message
  • pub = switch terminal to public use (everybody can enter commands)
  • priv = switch terminal to private use (only the owner can enter commands)
  • send <num> on/off = send on/off event to e. g. lamps (for testing purposes)
  • msg <num> <text> = send a text message to another Controller (for testing purposes)

For special Terminal commands for the SaferLua Controller, see Terminal Commands.