Expand the abbreviated string type and its conversion builtin to the full
word everywhere:
str -> string (the immutable-string type)
str(x) -> str -> string(x) -> string (the stringify builtin;
what `{…}` interpolation calls)
Types are recognized by identifier, and llty maps both spellings to LLVM
`ptr`, so this is an atomic source rewrite: type annotations, the Ludic
type tags, the builtin name/dispatch, and the interpolation desugar, plus
the grammars, LSP, docs (type-str -> type-string, fn-str -> fn-string), and
inventory. int/bool stay (universally accepted, like Math).
Reseeded; C-free fixpoint holds; all suites green (45/24/29); site + check.py OK.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
1.3 KiB
1.3 KiB
| id | name | category | kind | tokens | sig | tip | order |
|---|---|---|---|---|---|---|---|
| fn-world_save | world_save | ecs | builtin | world_save | world_save(buf) -> int | Serialize the whole world into a buffer; returns the number of bytes written. | 50 |
world_save serializes the entire ECS world — every live instance, its kind, and all its property fields — into a byte buffer you provide, and returns the number of bytes written. It is the low-level, buffer-based form of a save: allocate a buffer with bytes(n) large enough to hold the snapshot, pass it in, and persist the written bytes (or hand them across the mod ABI). The exact count comes back so you know how much of the buffer is meaningful. Restore a snapshot later with world_load. For a simple whole-game save to the default slot, the higher-level save() builtin is usually enough.
Parameters:
buf— the destination byte buffer, e.g. frombytes(n)
program SnapshotOut {
property Position { column: int = 0, row: int = 0 }
model Enemy { Position }
handler Boot phase Start {
spawn Grunt { Position { column: 3, row: 3 } }
}
handler Persist phase Update {
if Input.key() == 's' {
let buffer = bytes(4096)
let written = world_save(buffer)
Screen.status(string(written))
}
}
}