Skip to main content

Hierarchy

Node data access and layout scripting.

Runtime baseline

NodeReadData.paint, node:asPath(), and node:asPaint() remain tracked in the September 14, 2026 compatibility baseline. See Runtime Compatibility Baseline for the released Web line and source pins.


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​

AttributeTypeDescription
positionVectorLocal position
rotationnumberLocal rotation in radians
scaleVectorLocal scale
worldTransformMat2DWorld transform matrix
xnumberLocal position X
ynumberLocal position Y
scaleXnumberLocal scale X
scaleYnumberLocal scale Y
paintPaint?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, displayScale)​

Optional. When implemented, called after the layout receives a valid size and whenever that size or the presenting-surface display scale changes. A missing callback is a no-op; an unchanged scale does not redispatch it.

function resize(self: MyLayout, size: Vector, displayScale: number)
self.width = size.x
self.height = size.y
self.pixelWidth = size.x * displayScale
end
Existing callback compatibility

Direct Web 2.42.1, C++ runtime-v0.1.384, and the current editor/LSP surface agree on the three-argument form. displayScale is device pixels per layout point. Existing two-parameter Luau callbacks remain compatible because extra arguments are ignored.

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​