Object MethodCore Flow

Workflow.runWorkspace(actionId)

Compiler-owned action-plan lifecycle; do not call this manually in user code.

Documented for app version 1.0.64Updated:

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

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

When To Use It

Compiler-owned action-plan lifecycle; do not call this manually in user code.

Parameters and Return

Present in the catalogue for generated-plan validation. Macro identity, content, plan identity and action order are verified at runtime. A workspace cannot use these methods to control its parent plan.

Best Combined With

Edit legacy plans through the compatibility entry in Macro Settings; do not copy a generated wrapper into another macro. Use Workflow.get/set for shared invocation variables.

Example Usage

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

-- Workflow.runWorkspace is compiler-owned; no manual invocation.
-- Use Macro Settings to configure variables; legacy plans retain their compatibility editor.

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
-- Workflow.runWorkspace is compiler-owned; no manual invocation.
-- Use Macro Settings to configure variables; legacy plans retain their compatibility editor.

Simple

Wraps the base call with minimal flow control.

Simple
local stepOk = true
-- Workflow.runWorkspace is compiler-owned; no manual invocation.
-- Use Macro Settings to configure variables; legacy plans retain their compatibility editor.
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()
  -- Workflow.runWorkspace is compiler-owned; no manual invocation.
  -- Use Macro Settings to configure variables; legacy plans retain their compatibility editor.
end)

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

Detailed

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

Detailed
-- Workflow.runWorkspace(actionId)
local function run_runworkspace_step()
  -- Workflow.runWorkspace is compiler-owned; no manual invocation.
  -- Use Macro Settings to configure variables; legacy plans retain their compatibility editor.
end

local ok, err = pcall(run_runworkspace_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
-- Workflow.runWorkspace is compiler-owned; no manual invocation.
-- Use Macro Settings to configure variables; legacy plans retain their compatibility editor.