Lua is a very versatile programming language that can be used to greatly enhance any template. There are mainly two ways to use Lua in infoboxes: using it to generate the whole infobox or simply generate a part of it. Lua is interpreted by an extension called Scribunto, the Fandom version of which is a mostly feature-complete fork of the Scribunto core. Lua code is organized inside modules, which reside in the Module namespace. A module can hold multiple functions and data tables.
An infobox can be created using Fandom's own InfoboxBuilder, which facilitates its creation, or by generating template or HTML code using Scribunto's libraries. InfoboxBuilder was developed as a user-friendly markup to avoid infobox crafters needing to learn Lua's syntax, and is considered feature-complete, though not currently under development. It, like Scribunto, is enabled by default on all wikis.
It may even be possible to interface the lua-based infoboxes and the portable infoboxes.
Lua within infoboxes
Lua functions can be invoked within wikitext templates or by other modules. In fact, calling one module from another is one of the significant reasons to use Lua, as it is faster and more powerful than nested wikitext templates.
Within Portable Infoboxes, Lua functions can make it easier to format or parse text. At present, this is accomplished with invoke statements; future Portable syntax will accomplish the same effect natively inside the design.
Data in Modules
A data module is a "technical" jargon for a place to store information in a way that machines can read them. Some of the benefits of this are:
- Separating data - This allows data to be easily input or re-used and makes it faster to process related information.
- Avoiding template limits - If a page is too complex it may not load at all, data modules may improve the performance of some pages (see Lua Templating/Converting)
- Improving page performance - as noted above.
- Re-use - data can be re-used in many pages in different ways.
- Parsing information - Module:String
- Formatting and calculations - Global Modules/Formatnum
- Charts - Module:Chart