API:LabelGetText
From RoR Wiki
UI Lua API · Label functions
Version: WAR 1.4.8
Defined in Lua: interfacecore/source/windowstate.lua
Returns the text shown by a Label.
text = LabelGetText(labelName)
Arguments
- labelName
string– Name of a Label window.
Returns
- text
wstring– The label's text.
Details
- The client registers the C function as
_LabelGetText. TheLabelGetTextthat addons call is a Lua function defined ininterfacecore/source/windowstate.lua:- If the global table named after the window (
_G[labelName]) has aSTATEtable, it returnsSTATE.LABEL_TEXTwithout calling into the client. - Otherwise it calls
_LabelGetText(labelName).
- If the global table named after the window (
- For windows with state tracking enabled, the client writes the new text to
labelName.STATE.LABEL_TEXTeach time the text changes, for example through LabelSetText. _LabelGetTextreturns the text as it is displayed, not necessarily the exact string that was passed to LabelSetText: the client processes the displayed copy and shortens it if it is longer than the label's maximum length.- If an addon creates a global table with the same name as a label and gives it a
STATEfield,LabelGetTextreturns whatever that field'sLABEL_TEXTholds. Avoid usingSTATEas a field name on window tables.
Errors
Raised by _LabelGetText:
Error in function call 'LabelGetText': Window %s does not existError in function call 'LabelGetText': Window %s is not a Label
Example
Checking whether a tooltip line has text, from easystem_tooltips/source/itemtooltips.lua:
local hasExtraText = LabelGetText( tooltipWindow.."ActionText" ) ~= L""
