hasen wrote: ↑Sun Jan 28, 2018 11:36 am
I think everyone is confusing 'hot reload' with 'hot update'. Hot reload DOES have to reload the program each time, hence the word 'reload' in the name and the word 'reload' in the title of my thread. 'Hot update' is where I have a guy jumping on screen, I adjust the jump height and he starts jumping higher suddenly with no reload at all.
Hot reload is what the Corona simulator does as standard. That's the functionality I was after in Love2d.
I call that "hot restart". "Reload" to me applies to individual files, as in, when you modify a file, it is reloaded into the running program. Everyone else has understood it that way. "Restart" implies your application starts again from the beginning.
Hot restart is of course simple to get right for many workflows, starting in 0.10.2 as zorg mentioned.
AFAIK the libraries you mentioned upthread, lick and lovedebug, are aimed at hot swapping (using zorg's terms) or hot update (using your terms). They are not aimed at hot restarting.
I'm wondering if it's possible to call love.event.quit("restart") from a thread. The docs don't mention this, but I don't see why not. So, you could have a dedicated thread monitoring your filesystem. Perhaps even interfacing to a file modification monitor library via FFI if available.
The only problem I see with this way of restarting is that while hot restarting, you should ensure that your program returns false in the love.quit() event if you define it. That's where it may interfere with some workflows and require manual intervention. Maybe Löve could incorporate love.event.quit("forcerestart") to ignore the result of love.quit(), but I'm not sure that's wise. It would be best if Löve was also changed to make love.quit() receive a force parameter that is true if it will ignore the return value and quit straight away.