How To Call It
Region is a callable factory table: object methods are called as region:<method>(...), and the table’s own functions as Region.<method>(...).
An area of the screen to search and act in. Region(x, y, w, h) creates a Region object (Region() is the whole screen); find, click, wait, read and the geometry methods are called on that object with a colon.
Documented for app version 1.0.51Updated:
Region is a callable factory table: object methods are called as region:<method>(...), and the table’s own functions as Region.<method>(...).
In detection flow, refresh the screen with Snap.screenRefresh() first, then narrow the search area and confidence using Region and FindParam.
Region offers 79 methods; each method page lists its parameters and return value.
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 area = Region()
local hit = area:find(Asset.image("ok_button"))
if hit then quickTap(hit) 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 area = Region()
local hit = area:find(Asset.image("ok_button"))
if hit then quickTap(hit) endlocal area = Region()
local hit = area:find(Asset.image("ok_button"))
if hit then quickTap(hit) end
-- Continue with one focused method on the object.local area = Region()
local hit = area:find(Asset.image("ok_button"))
if hit then quickTap(hit) end
local note = "Region overview loaded"
print(note)-- In detection flow, refresh the screen with Snap.screenRefresh() first, then narrow the search area and confidence using Region and FindParam.
local function run_region_step()
local area = Region()
local hit = area:find(Asset.image("ok_button"))
if hit then quickTap(hit) end
end
local ok, err = pcall(run_region_step)
if not ok then
toast("Step failed")
print(err)
endSnap.screenRefresh()
local area = Region()
local hit = area:find(Asset.image("ok_button"))
if hit then quickTap(hit) end
toast("Detection step completed")