跳到主要内容

MatchResult:getX()

返回匹配区域左上角的 X 坐标。

描述

getX() 方法返回在屏幕上找到匹配项的左上角水平位置(X 坐标)。该值表示距离屏幕左边缘的像素位置。

签名

getX(): number

返回值

number - 匹配区域左上角的 X 坐标(以像素为单位)。

示例

local result = Screen:find("template.png")
if result then
local x = result:getX()
toast("Match found at X position: " .. x)
end