Scribunto: Why and how MediaWiki integrated Lua for templating

Short Form


The Scribunto ("They shall write") extension for MediaWiki allows wiki users to write Lua code to process and display text and data in articles. Learn why Wikimedia chose Lua, how it is integrated into our PHP-based web app, and what results have been seen since the deployment in March.


MediaWiki, the software behind Wikipedia, has long had “templates” which allow for content to be more readily formatted and included in multiple articles. And it has long had markup for simple conditionals, calculations, and extremely basic text processing known as “parser functions”. On this base, Wikipedia’s users have built some incredibly complex templates in wiki markup. Over time, unfortunately, those complex templates got unusably hard to read and edit, and badly affected our site performance.

Rather than continue to extend the inefficient and near-illegible parser functions with more complex methods and control structures, Wikimedia decided to embed a real programming language for text processing. Candidates included JavaScript and a home-grown scripting language, but in the end, Lua won out. We wrote code, we created test installations and an in-wiki “sandbox” for template testing, and a little over a year later, we deployed Scribunto to all Wikimedia Foundation wikis.

Brad, who worked on Scribunto and supporting libraries and editor tools, will talk about why the old parser functions needed to be replaced (warning: you will be amazed at what our editors had to put up with), why Lua was chosen, our constraints and design decisions, how the Scribunto extension interfaces MediaWiki (written in PHP) with Lua, and what results we’ve seen from our communities in the months since full deployment. You’ll also see an example conversion and hear about upcoming features, plans, and hopes.

Speaking experience

I've spoken about Scribunto and Lua a few times to Wikimedia staffers and developers; I gave a ten-minute presentation at a tech talk in February <>, and was one of the presenters in an hourlong presentation in March that had about 50 attendees <>. In May I will lead a hands-on tutorial for Wikimedia community members to help them convert old templates into Lua modules and invocations. If OSB accepts this proposal, it will be my first large conference talk.


  • Brad jorsch 3

    Brad Jorsch

    Wikimedia Foundation


    Brad has been an open source developer since the early 2000s, a MediaWiki developer since 2007 or 2008, and has worked for the Wikimedia Foundation since 2012.