Skip to content

Add grill run --hot and grill reload for Lua hot reload - #87

Merged
Frotty merged 2 commits into
masterfrom
hot-reload-commands
Oct 24, 2026
Merged

Frotty merged 2 commits into
masterfrom
hot-reload-commands

Conversation

@Frotty

@Frotty Frotty commented Oct 24, 2026

Copy link
Copy Markdown
Member

Problem

The compiler can hot reload a running Lua map (-luaHotReload, LuaHotReloadSession), but only the VS Code hot run drives it. Projects built with grill have no way to start a hot session or send an edit.

Behaviour

  • grill run --hot [map] builds the map with -luaHotReload, starts the compiler's hot reload session for _build (LuaHotReloadSession start, which also removes the payloads of an earlier session), and then launches Warcraft III with a copy of the built map in _build/grill/hot-run. The game keeps the map it runs open, and each reload builds the map again, so the two must be different files. If the session cannot be started (for example an installed compiler without hot reload), the game is not launched.
  • grill reload [map] builds the project again with the map and --dev setting of the hot run (recorded in _build/grill/hot-run.properties) unless another map is named, then runs LuaHotReloadSession send. It prints the payload and the compiler's warnings, or the compiler's refusal reasons and exits with 1. Without a hot session it exits with 1 and points to grill run --hot. Because grill uses the same _build/luaHotReload session and CustomMapData folder as the language server, a reload continues the numbering of a hot run started from VS Code and the other way round.
  • Payloads go to --custom-map-data <dir>, then the VS Code setting wurst.customMapDataPath, then CustomMapData in the Warcraft III documents folder.
  • Jass projects are rejected before building, with a pointer to JHCR.

Validation

  • HotReloadTests (stand-in compiler and session class; the launch is replaced, nothing starts the game) and the full WurstSetup suite pass on Windows.
  • With the current compiler master build and the stdlib, on a small Lua project (a class, a few functions and a doAfter closure); the launch went to a stub executable via --wc3-path:
    • run --hot wrote _build/luaHotReload/manifest.json and session.json, launched the copy, and the reload afterwards rebuilt _build/<map>.w3x while the copy stayed unchanged.
    • A body edit wrote CustomMapData/Wurst/hotreload-1.pld, byte-identical to the payload (and session state) that LuaHotReloadSession send produced for the same baseline and manifest. Further reloads continued at 2, 3 and 4.
    • A field type change printed the compiler's reasons and exited with 1, writing no file and leaving the session at its version.
    • An edit that removes a closure the map stored printed the compiler's warnings and wrote the payload.
    • A reload with no changes writes the next cumulative payload, as the language server does; one right after a hot run writes an empty payload 1.
    • A reload without a session exited with 1 and the compiler's "no map was started with hot run" reason.

Not verified: the launch itself and payload pick-up in the game. Also, the compiler's -build adds the build-only +opt/+inline lines of wurst_run.args, which its default file contains, and then rejects -luaHotReload with -inline/-opt. Until that is fixed in the compiler, run --hot and reload need a wurst_run.args without those lines.

run --hot builds with -luaHotReload, starts the compiler's hot reload
session for _build and then launches the map. reload rebuilds with the
hot run's map and --dev and writes the next payload through the
session's send, printing the payload and warnings, or the reasons and
exit code 1 when the edit is refused or no hot run was started.
Payloads go to CustomMapData in the Warcraft III documents folder,
--custom-map-data or wurst.customMapDataPath. Jass projects are
rejected (JHCR is the Jass tool).
The game keeps the map it runs open, and each grill reload builds the map
again into the same file. A hot run now launches a copy in _build/grill/hot-run.
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 24, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-24T17:23:28.434890Z d85ce1c PR opened
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

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