Skip to content

Return of Reckoning

Wiki

RoR Wiki

API:LabelSetText

From RoR Wiki

UI Lua API · Label functions
Version: WAR 1.4.8

Sets the text shown by a Label.

LabelSetText(labelName, text)

Arguments

labelName
string – Name of a Label window.
text
wstring – The text to show. It must be a wide string: L"Hello" works, "Hello" does not.

Returns

Nothing.

Details

  • Passing an ordinary Lua string or a number as text raises an Invalid Parameters error. Convert with towstring() first if necessary.
  • If the new text is the same as the current text, nothing happens.
  • Otherwise the client stores the text, processes a copy for display, shortens that copy if it is longer than the label's maximum length, and lays the text out again. LabelGetText returns the displayed copy.
  • For windows with state tracking enabled, the client writes the new text to labelName.STATE.LABEL_TEXT (see LabelGetText).
  • The function needs at least two arguments and only reads the last two.

Errors

  • Error in function call 'LabelSetText': Window %s does not exist
  • Error in function call 'LabelSetText': Window %s is not a Label

Example

From easystem_dialogmanager/source/dialogmanager.lua:

LabelSetText( "TwoButtonDlg"..dlgIndex.."BoxText", dialogText )
LabelSetText( "TwoButtonDlg"..dlgIndex.."BoxTimer", L"" )

See also