Skip to content

Class Size ​

A width and a height in logical pixels.

  • There is no Size(...) constructor. Where a Size is expected, pass a table with width and height, or two numbers in a row.

Errors when a width or height passed in is negative or NaN.

lua
local size = window.size
if size then
	print("app drew " .. size.width .. "x" .. size.height)
end
local square = Rect(Point(0, 0), { width = 300, height = 300 })

Properties ​

size.width: numberwidth read only ​

Never negative.

size.height: numberheight read only ​

Never negative.

Operators ​

size .. value -> stringsize .. value ​

The size as text joined with value turned into text, on either side: "app drew " .. window.size gives "app drew Size { width: 800, height: 600 }".