docs(0.S): the doc fences migrated by ludic migrate state; LANGUAGE.md's state section says what the tool and the checker do now; no module-level var left in the docs
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
19fcf60599
commit
a476ec7976
79 changed files with 481 additions and 355 deletions
|
|
@ -13,16 +13,18 @@ order: 3
|
|||
|
||||
```ludic
|
||||
program ScoreModule {
|
||||
var running_total: int = 0
|
||||
|
||||
@export function add_points(amount: int) -> int { # callable from a native host
|
||||
running_total = running_total + amount
|
||||
return running_total
|
||||
state ScoreModuleState {
|
||||
running_total: int = 0
|
||||
}
|
||||
|
||||
entry {
|
||||
print(add_points(10)) # 10
|
||||
print(add_points(5)) # 15
|
||||
@export function add_points(score_module_st: mut ScoreModuleState, amount: int) -> int { # callable from a native host
|
||||
score_module_st.running_total = score_module_st.running_total + amount
|
||||
return score_module_st.running_total
|
||||
}
|
||||
|
||||
entry (score_module_st: mut ScoreModuleState) {
|
||||
print(add_points(score_module_st, 10)) # 10
|
||||
print(add_points(score_module_st, 5)) # 15
|
||||
}
|
||||
}
|
||||
```
|
||||
|
|
|
|||
|
|
@ -16,13 +16,15 @@ program BootHook {
|
|||
property Health { current: int = 0, maximum: int = 100 }
|
||||
model Player { Health }
|
||||
|
||||
var elapsed_frames: int = 0
|
||||
|
||||
@OnStart handler CreateWorld { # runs once at boot
|
||||
spawn Player { Health { current: 100, maximum: 100 } }
|
||||
elapsed_frames = 0
|
||||
state BootHookState {
|
||||
elapsed_frames: int = 0
|
||||
}
|
||||
|
||||
handler CountFrames phase Update { elapsed_frames = elapsed_frames + 1 }
|
||||
@OnStart handler CreateWorld(boot_hook_st: mut BootHookState) { # runs once at boot
|
||||
spawn Player { Health { current: 100, maximum: 100 } }
|
||||
boot_hook_st.elapsed_frames = 0
|
||||
}
|
||||
|
||||
handler CountFrames(boot_hook_st: mut BootHookState) phase Update { boot_hook_st.elapsed_frames = boot_hook_st.elapsed_frames + 1 }
|
||||
}
|
||||
```
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue