carry.procNode
- .metadata226 B
- README.md1.9 KB
- carry.module
- init.luau2.0 KB
This package holds more than this page lists. See all of its files in its world.
README.md
attribute.carry (procNode)
Move every column of one class through an index map: element i of the result takes element index[i] of the source; an index naming no element reads zeros.
Built from one gather dispatch that writes index out as a run of the result length (a field over the result's elements takes its values there), then one call (io.luau, its columns left on the device) that moves every column the class holds, the structure columns and stored numbers such as id, N and uv included: each column of numbers by one gather on the device, and a column of values such as a text by moving the indices into its distinct values. A column whose source or index moves with time is gathered again on the device whenever they are rewritten. Then geometry[class].count is set to the result length. The result length is size when it is given and the length of index when it is left out.
Inputs
geometry(Geometry). The geometry whose columns move.class(one of point, vertex, primitive). Default"point". The class whose columns are moved.index(Column<Int>). For each element of the result, the source element it takes.size(Number, optional). How many elements the result holds; left out, the length ofindex. Anindexthat is a field over the result's elements needs it stated.
Outputs
geometry: the geometry whose class holds every column moved throughindex, counted by the result length. The other classes come through as they were.
Example
local points = g.points.grid({ countX = 4, countZ = 1, spacing = 1 })
local moved = g.attribute.carry({ geometry = points, class = "point", index = g.core.column({ values = { 3, 0 } }) })
moved holds two points, the fourth and the first. With a field as the index the length is stated: g.attribute.carry({ geometry = points, index = g.element.id * 2, size = 2 }) keeps the first and the third.