Hot reload: replacing a Script migrates instances and swaps behaviour (#86) #98

Merged
crowmaki merged 1 commit from hot-reload-86 into main 2026-09-06 06:34:16 +00:00
Owner

Closes #86.

Component.define no longer registers with Core while the chunk runs. Each define is queued and the batch commits only once the chunk completes, so a Script that fails while defining its second class leaves every Schema it defined last time in force. The methods table swaps on commit, so the next Update runs the new body while migrated instances keep their Handles and never re-run Awake or Start.

A field the old Schema did not carry is written with the default from the new define across every instance in every Scene, instead of the zero Core's migration leaves. A field spelled like the started bit is refused at define time, which closes the last Core-side refusal a define could reach; only an out-of-memory failure can now fail a commit partway.

Tests in tests/luau/reload_test.odin cover every acceptance criterion.

Closes #86. `Component.define` no longer registers with Core while the chunk runs. Each define is queued and the batch commits only once the chunk completes, so a Script that fails while defining its second class leaves every Schema it defined last time in force. The methods table swaps on commit, so the next `Update` runs the new body while migrated instances keep their Handles and never re-run `Awake` or `Start`. A field the old Schema did not carry is written with the default from the new define across every instance in every Scene, instead of the zero Core's migration leaves. A field spelled like the started bit is refused at define time, which closes the last Core-side refusal a define could reach; only an out-of-memory failure can now fail a commit partway. Tests in `tests/luau/reload_test.odin` cover every acceptance criterion.
Component.define no longer registers with Core while the chunk runs. Each
define is queued, and the whole batch is committed only after the chunk
completes, so a Script that fails while defining its second class leaves
every Schema it defined last time in force. The class's methods table is
swapped on commit, so the next Update runs the new body while migrated
instances keep their Handles and never re-run Awake or Start.

A field the old Schema did not carry is written with the default from the
new define across every instance, in every Scene, instead of the zero
Core's migration leaves. A field spelled like the started bit is refused at
define time, which closes the last Core-side refusal a define could reach.
crowmaki deleted branch hot-reload-86 2026-09-06 06:34:16 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
crowmaki/cinnabar!98
No description provided.