Skip to content
Konjure / spatial intelligence

get

← Builtin reference

Reads a typed component copy from an entity; the entity must have that component.

Signature

func get[C](entity: Entity) -> C

C means a concrete type selector. The result is a component copy; update the live entity with set, or use a system binding or bind[C](entity) method callback for persistent mutation.

Parameters

entity: Entity
An entity that has the selected concrete type component.

Returns

C

A copy of component C.

Examples

Select a component

The explicit selector fixes the component type for a function value.

Tick 0 · 0.00 s⌘ / Ctrl + EnterThis device
main.kj
Loading the language runtime…
Output 0
No output.
Expected output
2

Rust definition

Rust interpreter builtin dispatch; C must name a concrete type and is checked during specialization.

See also