API Reference › Annotations › @System
annotation

@System

"@System(Phase) function name() { … }"

@System(Phase) marks a function in a prebuilt binary module (one compiled with --emit-module) as a runtime-registered system. The module carries a load-time constructor that hands each such function to the host through ludic_register_system, and the host's frame loop calls it every Phase after its own handlers — the runtime, escape-hatch counterpart of the compile-time @EngineSystem. The compiler supplies the function's address (Ludic source cannot take one). This is how a closed-source or other-language module contributes systems over the reflection C-ABI; source packages that compile into the consumer should prefer @EngineSystem. Phases are Input, FixedUpdate, Update, LateUpdate and Render.

Example

program ManaModule {
  function module_init() -> void { world_register_prop("Mana", 2) }   # register a component at load

  @System(Update) function mana_regen() -> void {                     # runs every Update in the host
    let M = world_prop_id("Mana")
    let e = world_query_next(M, 0)
    if e >= 0 { world_set(e, M, 0, world_get(e, M, 0) + 1) }
  }
}
← All symbols