Comment by HexDecOctBin

18 hours ago

Have you done some kind of a write-up on how to do this? Lua is popular enough that I suspect there might actually be a demand of a readymade library to use hot reloading.

I haven't done a write up- I could, for sure. The code is all open source and the Lua side is only a few files.

The short of it is, you need a communication medium between LSP and your program. When you edit a text file, it needs to tell the program it updated, along with the latest text.

To communicate the values of variables is more work- you need a way to keep track of all changes to all variables. I wrote auto instrumentation code that wraps every modification to every variable in the files it instruments (which for livelove is everything but the library files themselves). Obviously this isn't perfect, but it does pretty well- and to see the value of anything you just need to make sure it's assigned to something somewhere or modified (very likely already the case).

---

There are absolutely hot reload Lua libraries- there's even an IDE where this is a key feature!

https://studio.zerobrane.com/