Lua is now available as a templating language on Wikia as we've backported the Scribunto extension to our version of MediaWiki. This helps us provide users with the ability to create more maintainable templates, and improve the performance of some of our slowest pages.
Lua is a dramatically different coding experience than basic wikitext templates, and resembles a more 'traditional' programming syntax (Lua being based on 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.
Enabling & Support[]
Lua is enabled by default on all Wikia wikis. The general standard Lua libraries along with the specialized Scribunto libraries and InfoboxBuilder are available.
In addition to the documentation linked below, DEV Wiki has a forum board set up on DEV Wiki to ask questions and get help.
Examples[]
Got a cool example of how Lua is being used on your wikia? Willing to allow other users on Wikia to tweak your design to meet their wikia's needs? Add a link to the Lua module with a quick description of what the module does!
You could also check out the list of Lua Modules.
[]
These are some Lua implementations for Navboxes:
- American Horror Story Wiki: Template/Module/CSS - Port from Wikipedia. Uses deprecated HtmlBuilder. Uses old collapsible class.
- Module dependencies: HtmlBuilder, Navbar, Arguments
- Final Fantasy Wiki: Template/Module/CSS - Lua version of the fallout wiki navbox. Uses old collapsible class.
- Professor Layton Wiki: Template/Module/CSS - Based on Wikipedia (same syntax), but redone from scratch.
- Module dependencies: None (VDE links need Template:Vdelinks)
- Runescape Wiki: Template/Module/CSS - Based on an older version of Wikipedia's template, has some extra code for embedding a stylesheet for use in the wikiamobile skin.
Infoboxes[]
Example 1[]
{{#infoboxbuilder: | 1:Type = Title
| 1:Value = Just a simple infobox
| 2:Type = MainImage
| 2:Value =
| 3:Type = Header
| 3:Value = FAQ
| 4:Type = Line
| 4:Label = Is it simple? | 4:Value = Yes, it is!
| 5:Type = Line
| 5:Label = Will I use it? | 5:Value = Every time!
}} If you want to create a simple infobox - it is really easy to do. The source code of the one on the right is:
{{#infoboxbuilder: | 1:Type = Title | 1:Value = Just a simple infobox | 2:Type = MainImage | 2:Value = [[File:Moon.jpg]] | 3:Type = Header | 3:Value = FAQ | 4:Type = Line | 4:Label = Is it simple? | 4:Value = Yes, it is! | 5:Type = Line | 5:Label = Will I use it? | 5:Value = Every time! }}
Documentation[]
- Converting wikitext templates
- InfoboxBuilder, an in-house Wikia tool for building infoboxes.
- w:c:dev:Lua reference manual, a comprehensive documentation page of Lua code
- Scribunto libraries
- Standard Lua libraries