Object MethodTouch and Actions

Navigation.stop()

Stops navigation owned by this macro. Returns true only after confirmed input release or when no journey is active; false must block screen actions. Does not stop the whole macro or automatically restart the journey.

Documented for app version 1.0.50Updated:

Detailed Explanation

This section explains when to use the API, how to call it, and which structures it works best with in production flow.

How To Call It

Navigation is a global table: call its functions with a dot (Navigation.<method>(...)), not a colon. Requires Macro Handler 1.0.51 or later.

When To Use It

Use before tapping a detected target or changing the screen inside an observation group while travelling. Ends the active journey of this macro. It is unnecessary when a point group should finish and return to the route.

Parameters and Return

Takes no arguments. true means confirmed input release or no active session. false means release could not be confirmed: do not execute the next screen action. Navigation.run finishes with STOPPED; the journey does not resume automatically.

Best Combined With

Check the scan result, confirm Navigation.stop(), then call click. requestStop() separately stops the whole macro. Before starting another journey, let the current callback and Navigation.run return; do not start nested journeys.

Example Usage

The snippet below is a starter pattern that can be applied directly in runtime flow.

if Navigation.stop() ~= true then
  error("NAVIGATION_RELEASE_UNCONFIRMED")
end
-- Screen actions may follow only after confirmed release.

Copyable Progressive Examples

From 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.

Foundation

Shows the shortest direct way to call the API.

Foundation
if Navigation.stop() ~= true then
  error("NAVIGATION_RELEASE_UNCONFIRMED")
end
-- Screen actions may follow only after confirmed release.

Simple

Wraps the base call with minimal flow control.

Simple
local stepOk = true
if Navigation.stop() ~= true then
  error("NAVIGATION_RELEASE_UNCONFIRMED")
end
-- Screen actions may follow only after confirmed release.
if stepOk then
  wait(200)
end

Practical Flow

A practical pattern for real macros with pcall, logging, and guards.

Practical Flow
local ok, err = pcall(function()
  if Navigation.stop() ~= true then
    error("NAVIGATION_RELEASE_UNCONFIRMED")
  end
  -- Screen actions may follow only after confirmed release.
end)

if not ok then
  print("API step failed: Navigation.stop: " .. tostring(err))
  requestStop()
end

Detailed

This level packages the API into a reusable helper with error reporting.

Detailed
-- Never continue to a screen action after an unconfirmed release
local function run_stop_step()
  if Navigation.stop() ~= true then
    error("NAVIGATION_RELEASE_UNCONFIRMED")
  end
  -- Screen actions may follow only after confirmed release.
end

local ok, err = pcall(run_stop_step)
if not ok then
  toast("Step failed")
  print(err)
end

Combined

Combines the API with related structures to form a more realistic workflow.

Combined
-- Inside an observation callback, after a target was detected:
if target then
  if Navigation.stop() ~= true then
    error("NAVIGATION_RELEASE_UNCONFIRMED")
  end
  click(target)
end
return true