Component¶
Type
Component reads and writes the fields of one component on an entity. Index an entity with the name of a component that has fields, as in entity.Timer, to get one; the result is nil when the entity does not have that component. Index the result with a field name to read or write that field. A single-value component such as Position returns its value instead. A built-in component uses the field names in Component views.
__iter¶
__iter visits every field of the component in declaration order, with its name and current value. The type checker does not see this iterator on component views, so a strict script casts the component to any to loop over it.