Button Button

Sputnik is written in Lua and uses Lua for extensions and configuration. Here is what's great about this.

Sputnik is written in Lua and exploits Lua's ability to serve at the same time as a programming language and a format for data storage.

When working with other programming languages, one typically separates the logic (written in, say, Java) and the data (stored as, say, XML or database tables). One reason for this is that Java source would not work well as a format for data, while XML doesn't work for expressing the logic. When using Lua, however, one can write the logic in Lua, and store the data in Lua too. Lua also provides an easy way to quickly and securely load Lua code from inside Lua.

Sputnik uses this extensively, storing almost everything it needs to store using Lua as a format. This means that there isn't a variety of ad hoc formats to learn. Everything is done using Lua. Node storage format? Lua! The permission rules? Lua! Lua is also a very dynamic language, even more so than Python. This comes in handy when working with heterogeneous data.

Sputnik also drew on Lua for inspiration for its data model. Lua uses prototype inheritance - somewhat like (McAfee), except in a cleaner way. Sputnik uses a similar approach: a node can have another node as its prototype, which means that it will fall back on that node's values when necessary. If you are familiar with Lua tables and Lua's metatables, this should sound familiar.

Disclosure

What's presented above is an ex post account of why Lua has turned out to be a good language to write Sputnik in and why you might want to consider Lua for a future project. It's not, however, the reason why Sputnik was written in Lua in the first place. We (Yuri and Adam), wrote the first version of Sputnik mostly in order to learn Lua, though the actual story is a bit stranger, and you should read Background if you want the details.