Alternatives to Lua as an embedded language?
Solution 1:
Since you say "embedded system" and "small and fast" and "integrate nicely" I would say you are correct that Lua is the number one if not the only choice. But I no longer agree that the programming language has "quirky corners". Firstly, the book Programming in Lua is simply splendid, one of the best books I have ever read. Secondly, some of the "quirky corners" come from the fact that the language is very orthogonal and clean, which in the long run is an asset, not a drawback. I find for example JavaScript much worse. If you read "Javascript the good parts" the author explains in length why some constructs in the language are design mistakes and why one should avoid the new operator. Not so in Lua, the bad parts have been removed, for example the quirky upvalue stuff was replaced with standard syntactic scoping in version 5.x.
My view is actually that Lua is a language with far less quirky corners than most other languages! We use it in a commercial project and we are more than happy with it.
Solution 2:
I wholeheartedly recommend Lua for your use case. However, Forth is an alternative--especially for resource constrained embedded devices--that has not yet been mentioned.
Solution 3:
There's always Lisp. :) But that underscores the fact that Lua is in fact less "quirky" than most languages. It was designed for non-programmers and reads like pseudocode. It has clean, uniform semantics (first class nested functions with lexical scoping; multiple assignment; multiple return values; a single, flexible data structuring mechanism with clean constructor syntax; etc.) which make it very easy to learn, read, write, etc. It also happens to be unexpectedly powerful and expressive (proper tail calls, continuations, metaprogramming, etc.)
The only really "quirky" aspect of Lua is that arrays index from 1, and that fact that it doesn't borrow C's conventions like everybody else (~=
rather than !=
, --
rather than //
, etc.), but these are mostly quirky through the eyes of programmers habituated to C-like languages.
An alternative might be Squirrel, which is inspired by Lua, has similar goals, but C-like syntax. I've not used it though, so I don't know well it meets it's goals.