Skip to content

Add bounded save-field and option commands to portable scripts - #120

Closed
Roxas2712 wants to merge 33 commits into
UNDERdecoded:mainfrom
Roxas2712:codex/portable-script-fields
Closed

Roxas2712 wants to merge 33 commits into
UNDERdecoded:mainfrom
Roxas2712:codex/portable-script-fields

Conversation

@Roxas2712

@Roxas2712 Roxas2712 commented Oct 22, 2026 •

Copy link
Copy Markdown

Adds set_field(key, value?) and set_option(key, value?) to API-3 portable scripts. Private mod:key fields use only the owning mod's save bucket; options retain native literal-key semantics. Omitted values delete the selected entry.

Depends on #119 and its prerequisites; merge that first. Focused review: https://github.com/Roxas2712/Gen2Recomped/compare/8a6eca8ebcc5501bc390f39de6aeba75b2878d48...5528ea28a9e8f9451aa27bbc6f2d411fa8ef2e62

Values are bounded acyclic plain data, snapshotted on compilation and copied on every execution. Store shapes are checked before admission and again at dispatch. A linear preflight accounts for an earlier options replacement. Native root-field and option semantics remain game-specific; runtime store changes can still stop later rows. Replacing the entire root modData store is deliberately refused, unlike the unrestricted reference write, so private-field ownership cannot be bypassed.

Validation:

  • 72 targeted assertions: all eight versions, mutation isolation, deletion/false values, invalid/changed stores, foreign namespaces, executable/nonfinite/cyclic/metatable data and aggregate limits.
  • 168 cross-engine comparisons / 336 isolated runs at clean feature and combined integration heads.
  • Feature 94/104 engine suites; integration 99/109. Exact baseline 17 failed assertions and 10 failed suites unchanged; SDK 3/3 and B30 pass.
  • Formatting and diff checks pass. No imported-ROM gameplay claim; writes do not automatically save to disk.

Hosted workflows await maintainer approval for this fork (action_required): API 3, ci. No hosted pass is claimed.

# Conflicts:
#	src/mods/Loader.lua
# Conflicts:
#	docs/modding.md
#	src/mods/Loader.lua
#	src/world/WorldAPI.lua
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant