Skip to content

Return of Reckoning

Wiki

RoR Wiki

API:LabelGetText

From RoR Wiki
Revision as of 19:46, 16 October 2026 by Maintenance script (talk | contribs) (UI Lua API import (WAR 1.4.8))
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

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. The LabelGetText that addons call is a Lua function defined in interfacecore/source/windowstate.lua:
    • If the global table named after the window (_G[labelName]) has a STATE table, it returns STATE.LABEL_TEXT without calling into the client.
    • Otherwise it calls _LabelGetText(labelName).
  • For windows with state tracking enabled, the client writes the new text to labelName.STATE.LABEL_TEXT each time the text changes, for example through LabelSetText.
  • _LabelGetText returns 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 STATE field, LabelGetText returns whatever that field's LABEL_TEXT holds. Avoid using STATE as a field name on window tables.

Errors

Raised by _LabelGetText:

  • Error in function call 'LabelGetText': Window %s does not exist
  • Error 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""

See also