Skip to content

Column

Type

Column reads and writes one value per entity that a Query matches. query:Column(Component.Position) returns the column of one component, and query:Entities() returns the column of matched entities. Index a column from 1 to #query; a column has no length of its own. Writing column[i] sets the component on the matching entity. An entry reads as nil once its entity is destroyed or loses the component.

Example

-- Server script in a part.
local Rising = World.DefineComponent("Rising")
self:Add(Rising)
self.Position = Vector3.new(0, 4, 0)

local rising = World.Query(Component.Position, Rising)
local pos = rising:Column(Component.Position)
for i = 1, #rising do
    pos[i] += Vector3.new(0, 6, 0)
end
print(math.round(pos[1].Y)) -- prints 10