Browse docs

Hot Reloading

lde run --hot watches your project’s source files and reloads changed modules when you save without restarting the process. Globals, open handles, and everything your modules do once at load time survive the reload.

Quickstart

  1. Create a project and cd into it:
lde new ./hello-hot
  1. Replace src/init.lua:
local greet = require("hello-hot.greet")
print(greet("world"))
  1. Make src/greet.lua:
return function(name)
	return "hello, " .. name
end
  1. Run it:
lde run --hot
  1. Change the greeting in src/greet.lua and save. lde drops the cached module, prints Reloaded: hello-hot.greet, and re-runs the entry point — the same process, the same state.

–hot vs –watch

lde run --watch re-runs the entry point on file changes too, but it tears down the guest state and creates a fresh one every time. --hot keeps the state and only replaces the changed modules.

--hot --watch
State Same state, only changed modules are replaced Fresh state each run (_G, package.loaded, globals)
Reload package.loaded entries dropped, entry re-runs Entire guest state recreated
Best for Long-running apps that keep connections, caches, or loaded C modules Anything that wants a guaranteed clean restart

Outside a package

--hot works for loose scripts too:

lde ./test.lua --hot

The current directory is watched and require() caches are patched the same way.

Limitations