Skip to content

LoadTextOverrides

Reads a file of texts - the game’s own table format or a JSON object - for every language or one.

file is a path in the game mode’s folder (the folder its .lua file is in). Two formats:

  • the game’s own localisation table, as a translation keeps it (.xml): every <Row>’s first <Cell> is the key and its last <Cell> the text - the files of a localisation mod (text_ui_quest.xml …) work as they are;
  • a JSON object of key to text (.json): {"location_opatovice": "Kingsbridge"}.

Each text is set as SetTextOverride would; a key or text it refuses is counted in the server’s log.

LoadTextOverrides(file [, language])
Parameter Type
file string the file, in the mode’s folder
language string the language its texts are for; left out = every language (optional)

number - the texts taken; nil and the reason when the file cannot be read

function OnGameModeInit()
local count, why = LoadTextOverrides("myserver/texts/places.json")
if not count then Log("texts: " .. why) end
LoadTextOverrides("myserver/texts/de/text_ui_quest.xml", "de")
end

SetTextOverride · ClearTextOverrides · the The game’s texts group of the index