Skip to content

Return of Reckoning

Wiki

RoR Wiki

API:ButtonSetText

From RoR Wiki
Revision as of 19:40, 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 · Button functions
Version: WAR 1.4.8

Sets the text shown on a Button.

ButtonSetText(buttonName, text)

Arguments

buttonName
string – Name of a Button window.
text
wstring – The text to show. It must be a wide string: L"Accept" works, "Accept" 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.
  • A Button with no text label (for example an icon-only button) silently ignores the call.
  • If the button is set to resize to its text, it is resized to fit the new text, plus its text padding on each side.
  • If the text does not fit, the client may print one of these warnings to the debug log. This happens only for buttons that have clipping warnings enabled.
    • Text is cut off in Button %s.
    • Font sized is auto-scaled down in Button %s.
  • The function needs at least two arguments and only reads the last two.

Errors

  • Error in function call 'ButtonSetText': Window %s does not exist
  • Error in function call 'ButtonSetText': Window %s is not a Button

Example

From easystem_dialogmanager/source/dialogmanager.lua:

ButtonSetText( "TextEntryDlg"..dlg.."ButtonCancel", GetPregameString(StringTables.Pregame.LABEL_CANCEL) )
ButtonSetText( "OneButtonDlg"..dlgIndex.."BoxButton1", buttonText )

See also