Builtin Library
README.md
field.attribute
A named attribute of a domain as a field. Wired, read off geometry; unwired, read off the domain the field is evaluated over. class picks the domain's point, vertex, primitive, edge or detail columns. A detail value stands for every element. The type and width come from the column, or from width for an unwired read of a name other than P, N and v.
Inputs
geometry(Geometry, optional). The geometry the attribute is read off. Left unwired, the attribute is read off the domain the field is evaluated over: a solver's particles, or the geometry an attribute write targets.name(String). Default"P". Which attribute to read,P(the position) when left alone. It has to be one the domain carries; a name it does not carry is an error.class(one of detail, edge, point, primitive, vertex). Default"point". Which domain's column is read. A detail value, one for the whole domain, is read as the same value at every element.width(Float). Default0. How many components the attribute holds whengeometryis unwired and it is not a position, normal or velocity (3 each). 0 reads one.
Outputs
field: the attribute as a field (unwired) or as the column itself (wired).
Example
local points = g.points.grid({ countX = 4, countZ = 1, spacing = 1 })
local out = g.attribute.set({ geometry = points, name = "v", value = g.field.attribute({ name = "P" }).x * 10 })
Each point's v is ten times its own x: -15, -5, 5, 15.