Skip to content

Return of Reckoning

Wiki

RoR Wiki

API:LoadStringTable

From RoR Wiki
Revision as of 19:46, 16 October 2026 by Maintenance script (talk | contribs) (UI Lua API import (WAR 1.4.8))
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

UI Lua API · StringTable functions
Version: WAR 1.4.8

Loads a localized string table from the game data so its strings can be looked up by the UI.

LoadStringTable(tableName, directory, fileName, cacheDirectory, luaTableName)

Arguments

tableName
string – Name to register the table under. Used later with UnloadStringTable and the string lookup functions.
directory
string – Folder of the string file, for example "data/strings/<LANG>".
fileName
string – Name of the string file in that folder, for example "pregame.txt".
cacheDirectory
string – Folder for the client's cache files of the table, for example "cache/<LANG>".
luaTableName
string – Path of a Lua table to fill with the string keys, for example "StringTables.Pregame". Pass "" for none.

Returns

Nothing.

Details

  • The file path is directory and fileName joined with a / (none is added if directory already ends with one).
  • The stock UI writes <LANG> in the folder names; the client replaces it with the current language.
  • The cache file is cacheDirectory/tableName.cache. When luaTableName is not empty, a second cache file cacheDirectory/tableName.cache2 is used as well.
  • tableName is compared without regard to case. A name that is already loaded is refused with an error.
  • When luaTableName is not empty, the Lua table at that path gets one number field per string key, named after the key. The stock UI uses these fields to look strings up, for example GetPregameString(StringTables.Pregame.LABEL_CANCEL).
  • If loading fails, the table is not registered and an error is raised.
  • The function needs at least five arguments and only reads the last five. All must be strings.

Errors

  • No StringTable file specified. (empty fileName)
  • StringTable name %s is already in use.
  • StringTable %s: %s (loading failed; the second value is the client's reason)

Example

From interfacecore/interfacecore.lua:

LoadStringTable("Pregame",            "data/strings/<LANG>",           "pregame.txt",             "cache/<LANG>", "StringTables.Pregame" )
LoadStringTable("Hardcoded",          "data/strings/<LANG>",           "hardcoded.txt",           "cache/<LANG>", "" )

See also