API Reference › Reflect › Reflect.kind
method

Reflect.kind

Reflect.kind(entity) -> int

Returns the model (archetype) id of entity — which kind of thing it is. Compare it against Reflect.model to branch on an entity's type, or use it to label a save record. Same as World.kind, under the reflection namespace.

Parameters

entitythe entity to identify

Example

program Demo {
  property Health { hp: int = 0 }
  model Unit { Health }
  entry {
    spawn Unit { Health { hp: 7 } }
    if Reflect.kind(0) == Reflect.model("Unit") { print(1) }
  }
}
← All symbols