Loop

typed block

When the same action (the same Action Identifier) is run multiple times, this block returns a result of "NotDone" a number of times equal to the specified loop count, then "Done" once, then reset.

Factories

Loop

Loop() -> LoopHandle

Construct a fresh Loop block with an auto-generated id.

Use this when authoring from scratch, the runtime picks a UUID automatically.

Loop

Loop(id: String) -> LoopHandle

Construct a Loop block with an operator-supplied id.

ParameterTypeRequiredDescription
idStringyesWire identifier, typically a Connect UUID restored by decompile so round-trips stay byte-stable.

Methods

loop_count

loop_count(value?: String) -> LoopHandle

Set the LoopCount parameter. Number of times to loop, must be between 0 and 100 (inclusive). Must either be fully static or fully dynamic.

ParameterTypeRequiredDescription
valueStringnoNumber of times to loop, must be between 0 and 100 (inclusive). Must either be fully static or fully dynamic.

loop_input

loop_input(value?: JSONPath) -> LoopHandle

Set the LoopInput parameter. A JSONPath reference to the array to loop over, one iteration per element, in place of LoopCount. Measured 2026-10-14: Connect refuses a literal, the empty string and a path outside the loop_input grammar.

ParameterTypeRequiredDescription
valueJSONPathnoA JSONPath reference to the array to loop over, one iteration per element, in place of LoopCount. Measured 2026-10-14: Connect refuses a literal, the empty string and a path outside the loop_input grammar.

loop_name

loop_name(value?: String) -> LoopHandle

Set the LoopName parameter. A name for the loop. Read from the console's loop fixtures.

ParameterTypeRequiredDescription
valueStringnoA name for the loop. Read from the console's loop fixtures.

next

next(target: Handle) -> LoopHandle

Wire the success-path transition. Substitutes the target's auto-generated UUID into the wire Transitions.NextAction slot.

ParameterTypeRequiredDescription
targetHandleyesThe block to route to once this block completes successfully.

on_no_matching

on_no_matching(target: Handle) -> LoopHandle

Wire an error transition for NoMatchingError: Route to take when Connect rejects the Loop block's state (typically: missing or malformed LoopCount).

ParameterTypeRequiredDescription
targetHandleyesBlock to route to on NoMatchingError. Route to take when Connect rejects the Loop block's state (typically: missing or malformed LoopCount).

on_continue_looping

on_continue_looping(target: Handle) -> LoopHandle

Wire a condition transition for Equals=ContinueLooping: Route to take while the loop has remaining iterations. Connect emits this branch each invocation until the iteration count reaches the LoopCount.

ParameterTypeRequiredDescription
targetHandleyesBlock to route to when the condition matches Operator=Equals, Operands=[ContinueLooping]. Route to take while the loop has remaining iterations. Connect emits this branch each invocation until the iteration count reaches the LoopCount.

on_done_looping

on_done_looping(target: Handle) -> LoopHandle

Wire a condition transition for Equals=DoneLooping: Route to take once the loop has completed its declared iterations.

ParameterTypeRequiredDescription
targetHandleyesBlock to route to when the condition matches Operator=Equals, Operands=[DoneLooping]. Route to take once the loop has completed its declared iterations.

set_id

set_id(id: String) -> LoopHandle

Override the auto-generated identifier with a specific wire id.

ParameterTypeRequiredDescription
idStringyesWire identifier override. Decompile threads this through to round-trip Connect-side UUIDs.

meta_position

meta_position(x: i64, y: i64) -> LoopHandle

Set the block's canvas position. Mostly auto-emitted by decompile; authored scripts call Flow.auto_layout() instead and let the layout pass fill positions in.

ParameterTypeRequiredDescription
xi64yesCanvas X coordinate.
yi64yesCanvas Y coordinate.

set_meta

set_meta(key: String, value: Dynamic) -> LoopHandle

Single-key escape hatch, set one ActionMetadata key by name when the typed meta_* setters don't cover it.

ParameterTypeRequiredDescription
keyStringyesWire key name (under Metadata.ActionMetadata[<id>]).
valueDynamicyesAny JSON-serializable Rhai value.

overwrite_meta

overwrite_meta(value: Map) -> LoopHandle

Full-replace escape hatch, overwrite the entire ActionMetadata blob.

ParameterTypeRequiredDescription
valueMapyesReplacement map for the entire ActionMetadata sub-object.

set_meta_param

set_meta_param(param: String, flag: String, value: Dynamic) -> LoopHandle

Set a single per-parameter ActionMetadata flag.

ParameterTypeRequiredDescription
paramStringyesParameter name (e.g. "Text").
flagStringyesFlag name ("useDynamic", "MFLAG_*", etc.).
valueDynamicyesFlag value.

overwrite_meta_param

overwrite_meta_param(param: String, value: Map) -> LoopHandle

Replace the entire flag map for one parameter.

ParameterTypeRequiredDescription
paramStringyesParameter name.
valueMapyesReplacement flag map for the parameter.

overwrite_parameters

overwrite_parameters(value: Map) -> LoopHandle

Wire-shape escape hatch, overwrite the entire Parameters blob.

ParameterTypeRequiredDescription
valueMapyesReplacement parameter map for the block.

raw_transitions

raw_transitions(value: Map) -> LoopHandle

Wire-shape escape hatch for non-canonical transition objects.

ParameterTypeRequiredDescription
valueMapyesReplacement transitions map (raw JSON shape).