function
world_register_prop
world_register_prop(name, fields) -> int
world_register_prop declares a brand-new property at runtime — one not present in the compiled program — and returns its property id. This is the dynamic-ECS entry point for mods: a mod can add its own component to the world, then world_attach_dyn it onto instances and read and write its fields with world_get/world_set. You give the property a name and its number of fields; the returned id then works everywhere a compiled property id does. Compiled programs that need no runtime-defined properties never call this — they declare property blocks at compile time instead.
Parameters
namethe new property's name, as a stringfieldshow many integer fields it hasExample
program ModComponent {
property Position { column: int = 0, row: int = 0 }
model Player { Position }
handler Boot phase Start {
spawn Hero { Position { column: 4, row: 4 } }
let stamina_property = world_register_prop("Stamina", 1)
Screen.status(string(stamina_property))
}
}