How To Call It
This is an object method: call it with a colon on the Result object a search such as region:find(...) returns (nil when nothing matched) (match:<method>(...)). Result is not a global name; the method exists only on that object.
Returns the measurement table of a match produced by a measuring engine (w, h, left, top, right, bottom, pixels, scanned, coverage, fill, blobs, step, exact, degraded), or nil when the engine does not measure. Use region:measure(...) to measure.
Documented for app version 1.0.51Updated:
This is an object method: call it with a colon on the Result object a search such as region:find(...) returns (nil when nothing matched) (match:<method>(...)). Result is not a global name; the method exists only on that object.
In detection flow, refresh the screen with Snap.screenRefresh() first, then narrow the search area and confidence using Region and FindParam.
Takes no arguments. Returns a Lua table, or nil.
It is typically combined with Snap, Region, Asset, and FindParam; you can feed the result into quickTap(), click(), or a follow-up OCR step.
The snippet below is a starter pattern that can be applied directly in runtime flow.
local match = Region(100, 200, 600, 80):measure(Asset.color("#22C55E"))
if match then
local metrics = match:getMetrics()
if metrics then print(metrics.w, metrics.coverage) end
endFrom foundation to combined usage, each level is provided as a separate code block so you can copy the level you need and adapt it directly.
local match = Region(100, 200, 600, 80):measure(Asset.color("#22C55E"))
if match then
local metrics = match:getMetrics()
if metrics then print(metrics.w, metrics.coverage) end
endlocal stepOk = true
local match = Region(100, 200, 600, 80):measure(Asset.color("#22C55E"))
if match then
local metrics = match:getMetrics()
if metrics then print(metrics.w, metrics.coverage) end
end
if stepOk then
wait(200)
endlocal ok, err = pcall(function()
local match = Region(100, 200, 600, 80):measure(Asset.color("#22C55E"))
if match then
local metrics = match:getMetrics()
if metrics then print(metrics.w, metrics.coverage) end
end
end)
if not ok then
print("API step failed: Result:getMetrics: " .. tostring(err))
requestStop()
end-- In detection flow, refresh the screen with Snap.screenRefresh() first, then narrow the search area and confidence using Region and FindParam.
local function run_getmetrics_step()
local match = Region(100, 200, 600, 80):measure(Asset.color("#22C55E"))
if match then
local metrics = match:getMetrics()
if metrics then print(metrics.w, metrics.coverage) end
end
end
local ok, err = pcall(run_getmetrics_step)
if not ok then
toast("Step failed")
print(err)
endSnap.screenRefresh()
local match = Region(100, 200, 600, 80):measure(Asset.color("#22C55E"))
if match then
local metrics = match:getMetrics()
if metrics then print(metrics.w, metrics.coverage) end
end
toast("Detection step completed")