Lua language logo

2006 September 02 20:48

I’m officially excited about the Lua programming language.

Lua is a small, elegant language, very carefully designed and implemented, with many, if not all, of the features that I want:

Lua has three “implementation” features that are important to me:

Philosophically Lua appeals to me. Everything about it is small. There are few key ideas, but they are good ones. The implementation is tiny. The language is tuned for size and speed, but because it’s designed to be linked to other code, it’s also designed for comprehensibility. And again, that means the smaller the better (since we can only use masterfully something we deeply understand). Lua is a convivial tool.

While most languages are profligate, Lua is parsimonious. The syntax is simple, the semantics straighforward; there few rules and fewer exceptions. The implementation is, by modern standards, tiny: a full host (x86) binary is ~140k bytes. It’s straightforward to slim this down to ~40k or less for use on small embedded devices.

Like all interpreted languages, Lua has the feature that data constructors and function definitions are executable code. This means that configuration files (for instance) are executable code. No longer is it necessary to write parsers for them; simply read them into Lua!

This fact, coupled with Lua’s clever – and only! – structured data type – the table – makes possible not only self-documenting XML-like structured data, but also data that, when executed, can produce an HTML (or XML – think RSS!) rendering of itself.


Resources: