ludic/changes/map-scoped-tables.md
2026-09-29 21:03:56 +03:00

1.5 KiB

bump: minor type: feature Map-scoped tables: @PerMap and @Chunked(n) registries — a registry whose rows live in each map's directory and are read when the map loads, or a chunk at a time.

@PerMap @ByKey registry Props of PropRow from "props.lres" reads <maps root>/<map>/props.lres (the root is package.ludic's new maps "assets/maps" line), and @PerMap @Chunked(64) registry Instances of InstRow from "instances/{cx}_{cz}.lres" one file per chunk. The compiler writes the table's state and its verbs in the declaring module (props_load, props_clear, props_find, props_path; instances_in, _out, _slot, _find, _clear, _path) and a typed fill over a small runtime .lres reader (runtime/native/lres.ludic, spliced on demand): a row names any int or float constant by name (resolved at load), a fn value by name, nested records and lists. Rows, their lists and the records in them are pooled and refilled in place, and _find is an allocation-free hash, so a load allocates nothing past the table's high water and a frame may bring a chunk in. @Ref(T) into a map table is a string key, checked against the same map. ludicc --check type-checks every map directory's tables against their records with file:line:col diagnostics (--no-maps to skip). The schema gives each registry a "scope" ("map" / "game") and "chunk", and a map @Ref "scope": "map"; @Unit now has canonical ASCII spellings (deg, m/s2, N.m, ...), listed as the schema's "units", and any other spelling is a warning naming the right one.