API Reference › Reflect › Reflect.prop
method

Reflect.prop

Reflect.prop(name) -> int

Resolves a property name to its stable id, or -1 if no such property exists. The id is what every other Reflect.* (and Query) call takes. Same as World.prop_id, under the reflection namespace.

Parameters

namethe property name

Example

program Demo {
  property Health { hp: int = 0 }
  model Unit { Health }
  entry {
    let H = Reflect.prop("Health")
    print(H)
  }
}
← All symbols