Skip to main content
Version: Canary 🚧

The Frame Object

Frames are the fundamental unit of data exchange in Loom. They act as standardized envelopes that wrap user signals with system metadata, ensuring the engine can route and normalize data regardless of the component type.

These functions are located in the module loom.frame.

loom.frame.new​

Creates a new frame instance. This is required when returning signals from a motif.plain or when manually constructing data nodes.

loom.frame.new(
kind: "node",
key: none,
path: (),
signal: none
)

Parameters​

ParameterTypeDefaultDescription
kindstr"node"The category of the component (e.g., "task", "ingredient").
keystrnonenone
patharray()The absolute path to the component in the hierarchy.
signalanynoneThe user-defined data payload.

loom.frame.normalize​

Ensures that data returned by a motif is converted into a consistent array<frame> structure.

  • none becomes ().
  • A single frame becomes (frame,).
  • Arrays are flattened and non-frame items cause a panic.
loom.frame.normalize(data)

loom.frame.is-frame​

Verifies if a value is a valid Loom frame by checking for the internal type: "frame" marker and all required metadata fields.

loom.frame.is-frame(data)

Returns: bool