Skip to content

Return of Reckoning

Wiki

RoR Wiki

API:GetStringFromTable

From RoR Wiki

UI Lua API · Interface functions
Version: WAR 1.4.8

Returns a localised string from one of the client's string tables.

text = GetStringFromTable(tableName, id)

Arguments

tableName
string – Name of the string table, for example "Default" or "HUDStrings".
id
number – Index of the string in the table. The stock UI uses the constants in StringTables.tableName.

Returns

text
wstring – The string, or L"" if it cannot be found.

Details

  • The table name is matched without regard to case.
  • If the table does not exist, two messages are logged (see Errors) and L"" is returned.
  • If id is outside the table, L"" is returned without any message.
  • The text is returned as stored. Placeholders are not filled in; use GetStringFormatFromTable for that.
  • The function needs at least two arguments and only reads the last two.

Errors

  • StringTable %s does not exist.
  • Error in function call 'GetStringFromTable': String Table %s does not exist.

Example

From easystem_eventtext/source/system_eventtext.lua:

[ GameData.CombatEvent.BLOCK ]           = GetStringFromTable("CombatEvents", StringTables.CombatEvents.LABEL_BLOCK ),
[ GameData.CombatEvent.PARRY ]           = GetStringFromTable("CombatEvents", StringTables.CombatEvents.LABEL_PARRY ),

See also