Module:GameText/doc

From Terraria Wiki
Jump to navigation Jump to search

Lua.svgThis is the documentation page for Module:GameText.


This module provides the functionality of the {{gameText}} template.

The module can be called from wikitext with the following functions:

Displays the string associated with the given key. If the given key refers to a group of strings (e.g. WorldGeneration), then it displays all strings in that group separated by the character . This is the most basic function and is used by {{gameText}}.
  • {{#invoke:GameText| getRaw | <key> | prefix = <output prefix> | postfix = <output postfix> | <placeholder replacements> | lang = <language> }}
Displays the string exactly as it is defined in the source language JSON file. The get function wraps its output in <span class="gameText"> and replaces linebreaks (\n) with HTML linebreaks (<br/>) for a more intuitive output. This function does not do that.
  • {{#invoke:GameText| listAll | <key> | lang = <language> }}
Displays all keys and their strings that are in the group of the given key (e.g. WorldGeneration), separated by the character ¦. The separator between each key and string is . If no key is provided, then merely lists all keys in the entire database.
  • {{#invoke:GameText| listKeys | <key> | lang = <language> }}
Similar to the listAll function, except that only the keys are displayed in any case, never the strings.
  • {{#invoke:GameText| printTable | lang = <language> }}
Displays a tabular visualization of the entire database, where the left column is the key and the right column is the string. The keys are ordered alphabetically.

The module can be called from another module with the following functions:

Returns the string associated with the given key.
Transforms the replacement arguments into a table and returns it.