Skip to main content

MatchResult:getMiddleY()

Returns the Y coordinate of the center point of the matched region.

Description

The getMiddleY() method returns the vertical center position (Y coordinate) of the matched area. This is useful when you want to perform actions like clicking on the center of the matched image or text.

The center Y coordinate is calculated as: getY() + (getHeight() / 2)

Signature

getMiddleY(): number

Returns

number - The Y coordinate (in pixels) of the center point of the matched region.

Example

local result = Screen:find("button.png")
if result then
local centerX = result:getMiddleX()
local centerY = result:getMiddleY()
-- Click on the center of the match
Screen:click(centerX, centerY)
end