This is an old revision of the document!
Table of Contents
Make your own Lua Scripts
under construction
What is Lua?
Simply said, Lua is “something” (a so called script interpreter) which is made to allow a program to run another program internally. The trick in that is, that the internal program does not need to be there when the “outer” program is made, it can be loaded later, just when you need it.
This allows to make a program now but change its behavior later as needed. This is widely used in the OOBD script engine: The script engine is there from the beginning, but what it does is defined by the script which is loaded at runtime. Another script, another functionality..
Luckely Lua became quite popular in the last years, so it's available for all major platforms, like Desktop PCs, Smartphone and Mobile Phones.
There are tons of documentation about Lua available in the internet, so we'll not explain the wheel here once more, we'll just focus on how Lua works inside OOBD.
The Lua - OOBD Interface
If Lua runs inside another program, without further assistance it does it like in a black box: No connection from the inside to the outside, no inputs, no feedbacks. This is obviously not very senseful, so when Lua is implemented into another program, there a normally some interfaces made up to let Lua and its host communicate to each other.
From the Lua perspective, these interfaces look like normal Lua function calls, but when such a function is called, the execution branches into the outer program, does something there and finally returns from that function back to Lua.
In the moment the OOBD interface supports two kinds of interfaces for Lua: Some for creating the menus, and some to talk to the serial line 1)