Memory Alpha
Advertisement
Memory Alpha
Help Contents → Lua
Lua

Lua is available as a template-building language on Memory Alpha, 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 that of 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.

Lua scripts have their own namespace inside the database, and therefore Lua pages typically start with the Module: prefix.

Support[]

Both the general standard Lua libraries and the specialized Scribunto libraries are available. Memory Alpha'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 the introduction to Lua.

Lua module repository[]

Lua modules can also be loaded from the Fandom Open Source Library using require("Dev:ModuleName"), as opposed to require("Module:ModuleName").[1] These "global modules" are available for re-use Fandom-wide and are described in more detail here.

Documentation and help[]

Lua documentation on the Fandom Open Source Library:

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

See also[]

Fandom Open Source Library (dev.fandom.com)

References[]

Advertisement