Skip to content
Konjure / spatial intelligence

has

← Builtin reference

Tests whether an entity has the selected concrete component type.

Signature

func has[C](entity: Entity) -> Bool

C means a concrete type selector. The result observes the entity's current component set and rejects an unknown entity rather than inventing absence.

Parameters

entity: Entity
An existing entity identity.

Returns

Bool

True when the entity has component C.

Examples

Test component presence

The selector is required when the function value would otherwise not identify C.

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

Rust definition

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

See also