Hierarchy
Node data access and layout scripting.
NodeReadData.paint, node:asPath(), and node:asPaint() remain tracked as live in the June 4, 2026 compatibility baseline. See Runtime Compatibility Baseline for the current npm line and source pins.
See Runtime Compatibility Baseline for tracked status.
NodeData
Writable node data with transform properties and hierarchy access.
Attributes
node.children
Child nodes. Type: table of NodeData (read-only)
node.parent
Parent node, or nil if root. Type: NodeData? (read-only)
Methods
node:decompose(worldTransform)
Updates position, rotation, and scale from a world transform matrix.
node:decompose(worldTransform: Mat2D)
See Also: NodeReadData
NodeReadData
Read-only node data providing transform properties.
Attributes
| Attribute | Type | Description |
|---|---|---|
position | Vector | Local position |
rotation | number | Local rotation in radians |
scale | Vector | Local scale |
worldTransform | Mat2D | World transform matrix |
x | number | Local position X |
y | number | Local position Y |
scaleX | number | Local scale X |
scaleY | number | Local scale Y |
paint | Paint? | Paint data (if ShapePaint node) |
Methods
node:asPath()
Casts the node to its PathData representation. Returns nil if not a path node.
node:asPath(): PathData?
node:asPaint()
Casts the node to its Paint representation. Returns nil if not a ShapePaint node.
node:asPaint(): Paint?
See Also: NodeData, Mat2D, PathData
Layout
Scripted layout that fits into layout boxes.
Protocol Methods
measure(self)
Optional. Enables intrinsic sizing. After measurement, resize() is called with granted dimensions.
function measure(self: MyLayout): Vector
-- Request specific size (may be constrained by min/max)
return Vector.xy(100, 100)
end
resize(self, size)
Required. Called on initial size and whenever size changes.
function resize(self: MyLayout, size: Vector)
self.width = size.x
self.height = size.y
end
Note: Layout extends the Node protocol. Layout scripts inherit all Node callbacks (init, advance, draw, pointer event handlers) in addition to measure and resize.
Next Steps
- Continue to System
- Verify surface status in Runtime Compatibility Baseline
- Need a refresher? Review Quick Reference