Skip to main content

Region:initiate()

Set the bounds of a region object in screen pixels.

Signature​

initiate(x: number, y: number, width: number, height: number): void

Parameters​

ParameterTypeDescription
xnumberLeft edge in pixels
ynumberTop edge in pixels
widthnumberWidth in pixels
heightnumberHeight in pixels

Returns

void

Description​

This is the low-level method the app uses to initialize a Region() object. Macros usually create a region with Region(x, y, width, height) instead, which calls initiate() for you. Call it directly only when reusing an existing object with new bounds.

Example​

local area = Region(0, 0, 100, 100)
area:initiate(100, 200, 300, 400)
toast(area:width() .. " x " .. area:height())