Help:Lua

Lua is available as a templating language on Fandom, helping to provide users with the ability to create more maintainable templates and to improve the performance of some of our slowest pages.

Lua is a different coding experience to basic wikitext templates, resembling a more 'traditional' programming syntax. It 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 into the Lua language, making the implementation of basic logic much easier in Lua than via MediaWiki's other methods. Second, because Lua is streamlined for logical operations, it performs better than its wikitext counterparts.

Lua (for wiki use) is not intended to replace JavaScript, CSS, or all wikitext templates.

Enabling and support
Lua is enabled by default on all wikis. When enabled, the general standard Lua libraries along with the specialized Scribunto libraries are also available. Fandom's implementation of Scribunto uses most standard features, but not all functions are supported; the differences are detailed in the reference manual.

For more background on the tool, read our introduction to Lua.

Lua module repository
Lua modules can also be loaded from the Fandom Open Source Library using, as opposed to. These "global modules" are available for re-use Fandom-wide and are described in more detail here.

Navbox Implementations
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
 * 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.
 * Module dependencies: Tnavbar, Yesno

Documentation and help
Lua documentation on the Fandom Open Source Library:
 * Converting wikitext templates
 * Reference manual, a comprehensive documentation page of Lua code
 * Scribunto libraries
 * Standard Lua libraries
 * More help pages

In addition to this documentation, we have a forum board set up here to ask questions and get help.

Further help and feedback
es:Ayuda:Lua fr:Aide:Lua it:Aiuto:Lua ja:ヘルプ:Luaテンプレート ko:도움말:루아 pl:Pomoc:Lua pt:Ajuda:Lua zh:Help:Lua vi:Trợ giúp:Lua ru:Справка:Lua