method
Query.count
Query.count(prop) -> int
Returns the number of live entities that carry the property prop (a property id from World.prop_id). A quick population count — how many enemies are alive, how many pickups remain — without writing a query loop.
Parameters
propa property id (from World.prop_id("Name"))Example
program Demo {
property Enemy { hp: int = 0 }
model Slime { Enemy }
entry {
spawn Slime { Enemy { hp: 3 } }
spawn Slime { Enemy { hp: 3 } }
let E = World.prop_id("Enemy")
print(Query.count(E)) # 2
}
}