July 25, 2020

👭 Knight Challenge #11 👬

Want to try your hand at these challenges? There's a couple of things you can do!
From writing, to research, to images, find your preferred way to contribute with our eleventh theme: Couples!

Latest Announcements

Guidelines:Modules/Data

From Zelda Wiki, the Zelda encyclopedia
Jump to: navigation, search
ZW Logo White.png
Getting Involved Getting Involved.png
Getting Involved
[1] Discord Logo.svg
Discord
Knight Challenges Knight Challenges Icon.png
Knight Challenges
Image edit request and support center Gimp Logo.svg
Image Requests
[2] Trello Logo.png
Trello
Guidelines:Main Guidelines Icon.png
Guidelines


The following guidelines concern /Data subpages in the module namespace. These are not to be confused with the pages in Data namespace.

Some modules rely on configuration data to generate output. By convention, this data is placed on a /Data subpage of the module. Module:Items/Data is an example of such a page — it contains all the data for generating the item navigation templates. Category:Module Data provides the list of such pages.

/Data pages exist to separate module data from the programmed logic that operates on the data. It is a separation of concerns. /Data pages require less programming knowledge to edit and are meant to be changed more frequently by a wider range of contributors.

Editing

Visualization

Some /Data pages display a tabular view of the data using the Documentation module. See Module:UtilsLanguage/Data and Module:Scale/Data, for example.

Most /Data pages also provide a schema which describes the format and fields for the data page. Currently it may be easier to understand the general format by looking directly at the data, but the schema can at least help you understand in detail what fields exist and what they are for.

How it Works

Main article: Guidelines:Modules

/Data pages use a subset of regular Lua syntax. They each return one large Lua table which may contain nested tables, strings, numbers, or booleans. /Data pages resemble JSON files in that regard.

The data is loaded by the base module using mw.loadData. The data is read-only and is loaded only once per wiki page, as opposed to other module code which is loaded each time it is used on a page (usually via a template).

These pages do not necessarily need to be named with a /Data suffix — this is only a Zelda Wiki convention that is useful for documentation automation and building a common understanding of the wiki's modules work.