The Lure of Lua

One of the key questions to consider in the RDFIO project was the use of the programming language Lua. It’s the scripting language of choice within large Wikimedia projects (Wikipedia, Wikidata etc), and I had positive feedback from people I asked about the possibility of using it. I researched its usage and syntax, and found it interesting and potentially exciting to work with, However, as with any design decision, I needed to consider both sides.

The case for using it was that it’s a powerful scripting language which can be used to write more elegant and faster code than the equivalent in PHP. The Scribunto extension within which it is used is well-maintained and stable, and used by major Wikimedia projects in production.

The primary use of Lua elsewhere in Wikimedia is for writing flexible and often complex templating functions, able to deal with wide variations in input parameters, or dynamically create content from data stores.  My initial intention was to use Lua to parse wikitext templates and carry out other data manipulation functions. However, Lua would also bring an additional dependency of the extension Scribunto.

Ultimately, I decided that the use of Lua in this context was not warranted. The potential benefits in terms of performance and code clarity are not great enough to justify adding another dependency. This may change if Scribunto is added to the standard MediaWiki or Semantic MediaWiki installations in future, in which case the more processing-intensive parts of the extension could be rewritten.