Repository navigation
Refactor Lua API - #12
Merged
Merged
Conversation
Consolidate the WIP SDK around an owned Lua state, registry-backed nodes, path-aware type errors, deterministic table traversal, and erased schema field translators. Compile the existing terrain content through nested Sprite and Rectangle schemas, remove abandoned API experiments, and add focused Catch2 coverage. Co-authored-by: Andrew Pogue <atpogue@outlook.com> Assisted-by: ChatGPT
refactor(lua): finish table translation API
Complete the WIP move of Lua-based content loading from the game layer into app, and bring the whole branch back to a compiling state. Lua library (app/lua): - Fallible operations return std::optional (or bool) and print their diagnostic to stdout, prefixed with the value's path. - Values and tables carry their path as a std::string, formatted the way it would be written in Lua (i.e. content.terrain["grass-1"].sprite). - Reference holds the lua_State* directly so it survives the owning State being moved. - Table::keys() returns integer keys ascending, then names sorted, so traversal order is deterministic. - Integer reads clamp to the destination type's range; number reads accept Lua integers. App: - load_content() runs the script, defines Game::Terrain in the world's catalog, and builds sprites parallel to the terrain definitions. Errors accumulate across definitions before failing. - App::State replaces Application and works on Game::World directly. - Port the deleted sdk Lua tests to app/tests. Game: - Finish the Game::World API and fix the grassland and cave generators. - Fix Command::is_empty(), which returned the inverse. Core: - Qualify detail::panic in PANIC so it works inside namespaces that have their own detail namespace. - Fix BasicCatalog::try_get returning a value instead of a pointer, and initialize its generation. - Give DEFER a unique, non-reserved variable name. Build: - Link game against GLM, which it uses for Pose and command movement. - README: require Clang 19+, the first version whose concepts support enables std::expected in libstdc++. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EukP9918Z3pX9d2utk9WWE
refactor(lua): finish moving content authorship to app
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Lua:
Game:
Game::WorldreplacesSimulationand theContextcapability types. Read-only access is now expressed withWorld const&.game/toapp/.App:
App::StatereplacesApplication.Pilotmoved toapp/.load_contentcollects errors from every definition before failing.Build:
-fno-exceptionseverywhere.