Hierarchy
Node data access and layout scripting.
NodeReadData.paint, node:asPath(), and node:asPaint() remain tracked in
the September 4, 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
| 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, 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
Direct Web 2.42.0, C++ runtime-v0.1.344, 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
- Continue to System
- Verify surface status in Runtime Compatibility Baseline
- Need a refresher? Review Quick Reference