How To Call It
Metrics is a singleton global table: call its functions with a dot (Metrics.<method>(...)).
Collects and summarises runtime metrics (scan and OCR counters).
Documented for app version 1.0.51Updated:
Metrics is a singleton global table: call its functions with a dot (Metrics.<method>(...)).
In system flow, design steps as observe first and act second when the API can affect device state.
Metrics offers 4 methods; each method page lists its parameters and return value.
Using this API with logging, error handling, and next-step control produces much more professional results than calling it in isolation.
The snippet below is a starter pattern that can be applied directly in runtime flow.
Metrics.enable()
-- ... run the scans ...
print(Metrics.summary())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.
Metrics.enable()
-- ... run the scans ...
print(Metrics.summary())Metrics.enable()
-- ... run the scans ...
print(Metrics.summary())
-- Continue with one focused method on the object.Metrics.enable()
-- ... run the scans ...
print(Metrics.summary())
local note = "Metrics overview loaded"
print(note)-- In system flow, design steps as observe first and act second when the API can affect device state.
local function run_metrics_step()
Metrics.enable()
-- ... run the scans ...
print(Metrics.summary())
end
local ok, err = pcall(run_metrics_step)
if not ok then
toast("Step failed")
print(err)
endMetrics.enable()
-- ... run the scans ...
print(Metrics.summary())
wait(200)
print("Combined with logging and flow control")