Board Thread:News and Announcements/@comment--20140604160246

Hello! Today, Wikia is pleased to rollout to Marvel Database the Scribunto extension which adds the ability to code templates in the Lua coding language. I’ll go over in a few moments what exactly this rollout entails on Marvel, but chances are you’ve already looked a few pages and not noticed a difference. That’s actually great; Lua changes how templates are written but ultimately the output you see on a Lua-coded page should look the same as it did yesterday.

Lua, while being a dramatically different coding experience than basic wikitext templates, resembles more of a 'traditional' programming syntax (Lua being based off of C) and thus offers two key advantages. First and foremost is that logical functionality – if, else, and while statements along with arrays and variable definition for instance - is built in to the Lua language, making the implementation of basic logic much easier in Lua than the hacky way MediaWiki adds it through extra add-ons and parser functions. Secondly, because Lua is streamlined for logical operations, it is much more technically efficient.

In our testing, switching a page to a Lua 'module' has on average decreased the amount of time it takes our servers to render a Marvel DB page by 40-50%. On some gallery pages, where we’ve been tinkering with the code for the last few months, the introduction of Lua compared with the other changes we’ve implemented have reduced page rendering and page load times by 80-85% on average.

So What's Changed?
The primary change is that we've flipped all the Marvel Database:Character Template pages over to invoke a Lua module instead of wikicode. Our staff has been hard at work writing this module for the last month and a half, and we believe we have successfully copied each and every facet from the old template to work just the same in the new module.

We tested on a number of pages on a dev test environment over the past few weeks and spent some time live testing with a handful of pages here Friday. All tests went well, so that is why, with the blessing of the Marvel DB leadership team, we are moving ahead now.

Of course, if you see any bugs with character pages since there may be one or two pages out there with special coding considerations we didn't test for, please let us know via this forum thread. Having all bug feedback in one place will help us quickly tweak the module and keep track of what needs to be done. I have also put the previous working code version at Marvel Database:Character Template/Old, so if a bug arises that causes serious enough display problems for a few page, please feel free to switch it back while we work on the test. I do ask you use this sparingly though and will re-migrate those pages back as soon as the issue is corrected on the code end.

Two other templates have been switched to Lua already: Template:MonthNo ‎and Template:Month.

What's Next?
We have a few other minor modules to port over in the coming days, but the Character Infobox is the heart of the change Wikia is doing. Lua is an "optional" feature so to speak. Marvel is one of the very few communities we will be coding the changes for - both because we are using Marvel to test the tool on a live, active community and because we were eager to get some performance improvements in place.

We are not going to be forcing your community or any community to move every template to Lua, nor frankly can we offer dedicated service to rewrite templates on request. Essentially Lua is there moving forward as an option, one we would strongly ask you consider as the 'best' option when coding complex templates.

How Can I Learn Lua?
The beginning stages of our documentation is now on DEV Wiki. As more wikias get this tool and we get more examples, that documentation will be further built out with examples other users can copy.

The Lua Reference Manual is the biggest chunk of documentation you will find, with directions and code snippets on just about every important thing you can do in Lua.

You can also check out Wikipedia, which uses Lua modules for just about anything and everything these days. The official Lua website is at www.lua.org

Once Wikia has rolled out Lua to more wikias to test and gather data on and are then prepared to available to all our communities, we will also do some dedicated training time through DEV Wiki chat as well as possibly through webinars. The general training plan has not yet been really mapped out, so questions you ask during this process and things we see will help us plan the most effective way to teach our userbase.

Questions? Concerns? Bring 'em! And thanks to the leadership team here for being willing to help us out with this cool and exciting project! 