method
Reflect.prop_name
Reflect.prop_name(index) -> string
Returns the name of the property at index (0 .. Reflect.prop_count()), or the empty string if out of range. The reverse of Reflect.prop — together they let a generic tool list every component by name.
Parameters
indexthe property indexExample
program Demo {
property Health { hp: int = 0 }
model Unit { Health }
entry {
var p = 0
let n = Reflect.prop_count()
while p < n {
print(Reflect.prop_name(p))
p = p + 1
}
}
}