Repository navigation
Lua: opt-in hot reload of function bodies - #1543
Conversation
-luaHotReload emits a script whose function bodies a payload can replace while the map runs; state, objects and the allocator are kept. A payload carries every function whose printed definition changed; an edit outside the bodies changes the ABI fingerprint and is rejected. The editor side writes the payload to a preload file which the map polls (single player); the in-game delivery is unverified, see docs/LUA_HOT_RELOAD.md and its probe. Without the flag the output is unchanged.
…easured in the game The id of a function whose signature has a type variable included the IM printer's identity hash, so two compilations of one map never matched: types are printed structurally now. A -luaHotReload build leaves its manifest in _build/luaHotReload, and LuaHotReloadSession's main turns two manifests into a preload file. Measured on the 3.0.1.24371 client: the map picked the payload up and ran the replaced bodies, state kept.
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c5fe2cfda3
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
-hotstart and -hotreload, which the editor's hot run and hot reload send, imply -luaHotReload on a Lua project, so no run argument has to be edited.
Measured in the game: Preloader never reads a file again after it was rewritten during the game, and setting a tooltip to "" leaves its text. So payload n goes to Wurst\hotreload-<n>.pld, the poll reads each file once in order, resets the tooltip to a space and only takes text after a marker. A hot run deletes earlier sessions' files. A hot-reload build names every function before translating any body, so a new local cannot take a function's name. The install is protected and the poll records its outcome.
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 2f9b021e29
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
… files atomically
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: ded63e8b9c
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 347bdb5ed5
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
…payload the session could not record
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 1ee8d820d4
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
…he session only once the map is launched
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 0a522fc1cc
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
…ayload files when a launch fails
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 264f7825bd
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
…ss a launch, roll back a partial set-aside
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 560d0a17cc
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
…lete only a superseded session's
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 77116c1075
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
…as a value is not reloadable
|
@codex review |
Opt-in hot reload of function bodies for Lua maps, behind
-luaHotReload. A running map takes a payload from the editor and replaces function bodies in place; globals, objects and the allocator keep their state. Design and limits:docs/LUA_HOT_RELOAD.md.How it works
CustomMapData\Wurst\hotreload-<n>.pld. The map polls for the next file once a second, in single player only; the file's Lua section puts a marker and the payload in an ability tooltip, and the map checks the fingerprint and version, then installs withload(..., _ENV).__wurst_hotreload_status()and an on-screen message say what became of each payload.-hotstart) builds with-luaHotReload, andwurst.hotreload(-hotreload) writes the next cumulative payload instead of calling JHCR. No run argument has to be edited.-luaHotReloadrefuses-inlineand-opt.Evidence
-luaHotReload: the editor's payload, delivered while the map ran, changed a function called by name (1 → 2) and an override reached through its class table (4 → 40) on objects made before and after the reload. A sibling's override stayed 3, a global kept its value, and the allocator was not reset. The new body answered within 0.5 s of the first check.wurst.hotstartmap, then an edit saved (didChange,didSave) andwurst.hotreload. The request compiled and wrote the payload in 3.7 s, and the running map ran the new bodies 4.5 s after it was ready, with the same results.-stacktraceson and the language server driven the same way: one payload editing 15 kinds of body (free function, override, trigger action and periodic callback registered before the reload, both kinds of generics, tuple result, varargs, constructor,ondestroy, a string with quotes/backslash/ü///!, static function); 300 functions at once (a 93.7 KB file, including a function with 210 locals); an undo; a stale, a foreign and a broken payload, all rejected without effect; a new function rejected by the server, then a valid edit. All checks passed; reloads took 3.1 to 7.9 s in the server and applied 5 to 8.5 s after the map was ready.Preloadernever reads a file again after it was rewritten during the game, while a new file is read within 0.5 s; setting a tooltip to""leaves its text; a tooltip and a preload file each carry 200,000 characters; a thread waiting inTriggerSleepActionthrough a reload resumes in its old body and calls the new one by name.-inline -localOptimizations -opt(rechecked after the last change).LuaHotReloadTests(13),RunArgsTests(with the hot run implication),LuaTranslationTests,LuaBackendAuditTestsandHotReloadPipelineTestspass locally (Windows only).Not covered yet
How often a real project's edits are rejected, and its payload sizes and reload times. Multiplayer is not supported: the files are local, so applying them would desync.