String tables are used by the Tombstone Engine to store human-readable text strings in resources that are external to the engine code and game code. The use of string tables is not required, but they can be convenient for storing strings separately in order to make localization easy and allow text to be changed without the need to recompile your game.
String Table Resources
String table resources have the
.str file extension and reside inside subfolders of the
Data directory. These files are stored in a binary format and are created by using the String Importer tool to import text files from the
A string table resource is loaded by constructing a
StringTable class with the name of the resource, omitting the top-level folder name inside the
Data folder. Strings can be retrieved from the string table by calling the
StringTable::GetString() function with a
StringID object containing the identifier(s) for the string. For example, a string having the identifier
'type' can be retrieved using the following code.
const char *string = stringTable->GetString(StringID('type'));
A string nested within a hierarchy can be retrieved by adding more types to the
StringID object as in the following code.
const char *substring = stringTable->GetString(StringID('type', 'abcd'));
Up to five identifiers can be specified.