<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.returnofreckoning.com/index.php?action=history&amp;feed=atom&amp;title=API%3ALoadStringTable</id>
	<title>API:LoadStringTable - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.returnofreckoning.com/index.php?action=history&amp;feed=atom&amp;title=API%3ALoadStringTable"/>
	<link rel="alternate" type="text/html" href="https://wiki.returnofreckoning.com/index.php?title=API:LoadStringTable&amp;action=history"/>
	<updated>2026-10-17T14:20:37Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.43.11</generator>
	<entry>
		<id>https://wiki.returnofreckoning.com/index.php?title=API:LoadStringTable&amp;diff=30566&amp;oldid=prev</id>
		<title>Maintenance script: UI Lua API import (WAR 1.4.8)</title>
		<link rel="alternate" type="text/html" href="https://wiki.returnofreckoning.com/index.php?title=API:LoadStringTable&amp;diff=30566&amp;oldid=prev"/>
		<updated>2026-10-16T19:46:38Z</updated>

		<summary type="html">&lt;p&gt;UI Lua API import (WAR 1.4.8)&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;{{LuaApi|group=StringTable}}&lt;br /&gt;
Loads a localized string table from the game data so its strings can be looked up by the UI.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
LoadStringTable(tableName, directory, fileName, cacheDirectory, luaTableName)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Arguments ==&lt;br /&gt;
;tableName : &amp;lt;code&amp;gt;string&amp;lt;/code&amp;gt; – Name to register the table under. Used later with [[API:UnloadStringTable|UnloadStringTable]] and the string lookup functions.&lt;br /&gt;
;directory : &amp;lt;code&amp;gt;string&amp;lt;/code&amp;gt; – Folder of the string file, for example &amp;lt;code&amp;gt;&amp;quot;data/strings/&amp;amp;lt;LANG&amp;amp;gt;&amp;quot;&amp;lt;/code&amp;gt;.&lt;br /&gt;
;fileName : &amp;lt;code&amp;gt;string&amp;lt;/code&amp;gt; – Name of the string file in that folder, for example &amp;lt;code&amp;gt;&amp;quot;pregame.txt&amp;quot;&amp;lt;/code&amp;gt;.&lt;br /&gt;
;cacheDirectory : &amp;lt;code&amp;gt;string&amp;lt;/code&amp;gt; – Folder for the client&amp;#039;s cache files of the table, for example &amp;lt;code&amp;gt;&amp;quot;cache/&amp;amp;lt;LANG&amp;amp;gt;&amp;quot;&amp;lt;/code&amp;gt;.&lt;br /&gt;
;luaTableName : &amp;lt;code&amp;gt;string&amp;lt;/code&amp;gt; – Path of a Lua table to fill with the string keys, for example &amp;lt;code&amp;gt;&amp;quot;StringTables.Pregame&amp;quot;&amp;lt;/code&amp;gt;. Pass &amp;lt;code&amp;gt;&amp;quot;&amp;quot;&amp;lt;/code&amp;gt; for none.&lt;br /&gt;
&lt;br /&gt;
== Returns ==&lt;br /&gt;
Nothing.&lt;br /&gt;
&lt;br /&gt;
== Details ==&lt;br /&gt;
* The file path is &amp;lt;code&amp;gt;directory&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;fileName&amp;lt;/code&amp;gt; joined with a &amp;lt;code&amp;gt;/&amp;lt;/code&amp;gt; (none is added if &amp;lt;code&amp;gt;directory&amp;lt;/code&amp;gt; already ends with one).&lt;br /&gt;
* The stock UI writes &amp;lt;code&amp;gt;&amp;amp;lt;LANG&amp;amp;gt;&amp;lt;/code&amp;gt; in the folder names; the client replaces it with the current language.&lt;br /&gt;
* The cache file is &amp;lt;code&amp;gt;&amp;#039;&amp;#039;cacheDirectory&amp;#039;&amp;#039;/&amp;#039;&amp;#039;tableName&amp;#039;&amp;#039;.cache&amp;lt;/code&amp;gt;. When &amp;lt;code&amp;gt;luaTableName&amp;lt;/code&amp;gt; is not empty, a second cache file &amp;lt;code&amp;gt;&amp;#039;&amp;#039;cacheDirectory&amp;#039;&amp;#039;/&amp;#039;&amp;#039;tableName&amp;#039;&amp;#039;.cache2&amp;lt;/code&amp;gt; is used as well.&lt;br /&gt;
* &amp;lt;code&amp;gt;tableName&amp;lt;/code&amp;gt; is compared without regard to case. A name that is already loaded is refused with an error.&lt;br /&gt;
* When &amp;lt;code&amp;gt;luaTableName&amp;lt;/code&amp;gt; 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 &amp;lt;code&amp;gt;GetPregameString(StringTables.Pregame.LABEL_CANCEL)&amp;lt;/code&amp;gt;.&lt;br /&gt;
* If loading fails, the table is not registered and an error is raised.&lt;br /&gt;
* The function needs at least five arguments and only reads the last five. All must be strings.&lt;br /&gt;
&lt;br /&gt;
== Errors ==&lt;br /&gt;
* &amp;lt;code&amp;gt;No StringTable file specified.&amp;lt;/code&amp;gt; (empty &amp;lt;code&amp;gt;fileName&amp;lt;/code&amp;gt;)&lt;br /&gt;
* &amp;lt;code&amp;gt;StringTable name %s is already in use.&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;StringTable %s: %s&amp;lt;/code&amp;gt; (loading failed; the second value is the client&amp;#039;s reason)&lt;br /&gt;
&lt;br /&gt;
== Example ==&lt;br /&gt;
From &amp;lt;code&amp;gt;interfacecore/interfacecore.lua&amp;lt;/code&amp;gt;:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
LoadStringTable(&amp;quot;Pregame&amp;quot;,            &amp;quot;data/strings/&amp;lt;LANG&amp;gt;&amp;quot;,           &amp;quot;pregame.txt&amp;quot;,             &amp;quot;cache/&amp;lt;LANG&amp;gt;&amp;quot;, &amp;quot;StringTables.Pregame&amp;quot; )&lt;br /&gt;
LoadStringTable(&amp;quot;Hardcoded&amp;quot;,          &amp;quot;data/strings/&amp;lt;LANG&amp;gt;&amp;quot;,           &amp;quot;hardcoded.txt&amp;quot;,           &amp;quot;cache/&amp;lt;LANG&amp;gt;&amp;quot;, &amp;quot;&amp;quot; )&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
* [[API:UnloadStringTable|UnloadStringTable]]&lt;br /&gt;
* [[API:BuildTableFromCSV|BuildTableFromCSV]]&lt;/div&gt;</summary>
		<author><name>Maintenance script</name></author>
	</entry>
</feed>