Lua, Lua

Whilst I was looking for an embedded scripting library for the HMI I found a little language that is taking the computer gaming industry by storm. Well, I don't know about that but the language is called Lua. It's tiny, simple and easy to embed. I was starting to get a little worried about all the baggage that TCL or Python was going to bring with them. I don't really need a socket interface for an HMI scripting engine. Lua is extremely simple to embed. I had a 10 line C program calling a Lua script in less than an hour, and most of that hour was trying to figure out why the 4.0 documentation I was reading wouldn't work in 5.0.

At this moment I am leaning toward Lua being the primary scripting language for all things OpenDAX.  I am even considering using Lua scripts as configuration files.  I'll have to decide what I think about that.

There are some problems.  The biggest is the library dependence.  Lua is not so widespread that I can assume that it'll be on most computers out there already.  It's not a big deal to install but there are some 'issues.'  As I mentioned earlier there are some API changes between 4.x and 5.x.  There are even some changes between 5.0 and 5.1.  This has lead some distributions to separate the libraries and give them different names (i.e. liblua40 vs liblua50).  Some distributions leave them as liblua.  I'm sure that this will cause the autoconf stuff to get pretty ugly.  It'll probably be worth it.  Besides I could distribute lua and link statically if I need to.  It is quite small.  That is a last resort.

It should still be a pretty easy thing to build binary packages for OpenDAX and people that will be compiling it from source should be used to these kinds of things.  I'll probably require the library for now and see what happens. 

I intend to write a daxlua logic module very soon.  I may never get around to writing a module for ladder logic and function blocks (hopefully someone else will) and I had intended to just write my near term home automation logic in C because I was afraid that Ruby bindings would take too much time.  I think that I can have a Lua module done in a day or so.  Check back soon to see how this turns out.