WoW:API GetText: Difference between revisions
No edit summary |
m (Move page script moved page API GetText to API GetText without leaving a redirect) |
||
| (5 intermediate revisions by 4 users not shown) | |||
| Line 1: | Line 1: | ||
<br>{{framexmlfunc|FrameXML/LocaleProperties.lua}} __NOTOC__ | |||
GetText is used to localize some game text like PvP-ranks or spell text. | |||
strResult = GetText(sIdentifier, nNumber, ordinal); | |||
sIdentifier | GetText is used to localize some game text like PvP-ranks or spell text. | ||
nNumber | |||
== Parameters == | |||
=== Arguments === | |||
:;sIdentifier:String - Identifier for the text to localize i.e.: PVP_RANK_5_1 | |||
:;nNumber:Number - Number that is used in the text (for format-strings), can be nil. GetText does not seem to use this. | |||
This is used for all the PvP-ranks titles that are displayed above characters (and some other stuff). So if you i.e. replace this with a function, that always returns "stupid", all players with PvP-ranks will run around with a name tag like "stupid xyz". This is used rarely and I am not sure what kind of ID-keys you can used. | :;ordinal:Unknown | ||
=== Returns === | |||
:;:strResult:String - The localized text corresponding to sIdentifier, an empty string if the global variable corresponding to sIdentifier exists, but is not a string, or nil if sIdentifier doesn't exist. | |||
== Notes == | |||
* This is used for all the PvP-ranks titles that are displayed above characters (and some other stuff). So if you i.e. replace this with a function, that always returns "stupid", all players with PvP-ranks will run around with a name tag like "stupid xyz". This is used rarely and I am not sure what kind of ID-keys you can used. | |||
* This function ''appears'' to do the same thing as [[API getglobal|getglobal]] except that it only returns string values. | |||
** Examples | |||
:<pre> local var1 = getglobal("ChatFrame1") -- var1 is a reference to <frame> ChatFrame1.</pre> | |||
:<pre> local var2 = GetText("ChatFrame1") -- var2 is an empty string (<string> "").</pre> | |||
:<pre> local var3 = getglobal("YES") -- var3 is <string> "Yes" (on enUS clients).</pre> | |||
:<pre> local var4 = GetText("YES") -- var4 is <string> "Yes" (on enUS clients).</pre> | |||
Latest revision as of 04:46, 15 August 2023
This function is implemented in Lua here FrameXML/LocaleProperties.lua.
strResult = GetText(sIdentifier, nNumber, ordinal);
GetText is used to localize some game text like PvP-ranks or spell text.
Parameters
Arguments
- sIdentifier
- String - Identifier for the text to localize i.e.: PVP_RANK_5_1
- nNumber
- Number - Number that is used in the text (for format-strings), can be nil. GetText does not seem to use this.
- ordinal
- Unknown
Returns
- strResult
- String - The localized text corresponding to sIdentifier, an empty string if the global variable corresponding to sIdentifier exists, but is not a string, or nil if sIdentifier doesn't exist.
Notes
- This is used for all the PvP-ranks titles that are displayed above characters (and some other stuff). So if you i.e. replace this with a function, that always returns "stupid", all players with PvP-ranks will run around with a name tag like "stupid xyz". This is used rarely and I am not sure what kind of ID-keys you can used.
- This function appears to do the same thing as getglobal except that it only returns string values.
- Examples
local var1 = getglobal("ChatFrame1") -- var1 is a reference to <frame> ChatFrame1.local var2 = GetText("ChatFrame1") -- var2 is an empty string (<string> "").local var3 = getglobal("YES") -- var3 is <string> "Yes" (on enUS clients).local var4 = GetText("YES") -- var4 is <string> "Yes" (on enUS clients).