restart on a remote command from the driver

This should be useful for ensuring that apps work the same after
restart.
This commit is contained in:
Kartik K. Agaram 2023-04-07 18:18:43 -07:00
parent 480d8700e2
commit f387c40d95
2 changed files with 9 additions and 0 deletions

View File

@ -216,6 +216,8 @@ function live.run(buf)
print('command is '..cmd)
if cmd == 'QUIT' then
love.event.quit(1)
elseif cmd == 'RESTART' then
restart()
elseif cmd == 'MANIFEST' then
Live.manifest[APP] = love.filesystem.getIdentity() -- doesn't need to be persisted, but no harm if it does..
live.send_to_driver(json.encode(Live.manifest))

View File

@ -63,6 +63,13 @@ function love.quit()
love.filesystem.write('config', json.encode(settings()))
end
function restart()
if on.quit then on.quit() end
love.filesystem.write('config', json.encode(settings()))
load_settings()
if on.initialize then on.initialize() end
end
function settings()
local x, y, displayindex = App.screen.position()
return {