Skip to content

Return of Reckoning

Wiki

RoR Wiki

API:WindowGetDimensions

From RoR Wiki
Revision as of 19:51, 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 · Window functions
Version: WAR 1.4.8
Defined in Lua: interfacecore/source/windowstate.lua

Returns a window's width and height.

width, height = WindowGetDimensions(windowName)

Arguments

windowName
string – Name of the window.

Returns

width, height
number – The window's size, before its scale is applied.

Details

  • The size is in the window's own units. The size on screen is these values multiplied by the window's scale (WindowGetScale).
  • The client registers the C function as _WindowGetDimensions. The WindowGetDimensions that addons call is a Lua function defined in interfacecore/source/windowstate.lua:
    • If the global table named after the window (_G[windowName]) has a STATE table, it returns STATE.DIMENSION_X and STATE.DIMENSION_Y without calling into the client.
    • Otherwise it calls _WindowGetDimensions(windowName).
  • For windows with state tracking enabled, the client writes the new size to windowName.STATE.DIMENSION_X and DIMENSION_Y whenever the size changes, for example through WindowSetDimensions.
  • If an addon creates a global table with the same name as a window and gives it a STATE field, WindowGetDimensions returns whatever that table holds. Avoid using STATE as a field name on window tables.

Errors

  • Error in function call 'WindowGetDimensions': Window %s does not exist (from _WindowGetDimensions)

Example

Making a dialog cover the screen, from easystem_dialogmanager/source/dialogmanager.lua. The root window's size is divided by the interface scale because the dialog's size is scaled when it is drawn:

local x, y = WindowGetDimensions( "Root" )
x = x / InterfaceCore.GetScale()
y = y / InterfaceCore.GetScale()
WindowSetDimensions( "OneButtonDlg"..dlgIndex, x, y ) -- Set to the screen width and height

See also