Add love.event.restart(optionalvalue) as a shorthand for love.event.quit("restart", optionalvalue). If a Lua value is provided as an argument, a new love.restart field will contain the value after restarting.

--HG--
branch : minor
This commit is contained in:
Alex Szpakowski
2019-12-28 22:43:39 -05:00
parent 443250ffd5
commit b001b2e1d5
6 changed files with 65 additions and 20 deletions
+3 -3
View File
@@ -598,7 +598,7 @@ function love.run()
for name, a,b,c,d,e,f in love.event.poll() do
if name == "quit" then
if not love.quit or not love.quit() then
return a or 0
return a or 0, b
end
end
love.handlers[name](a,b,c,d,e,f)
@@ -799,8 +799,8 @@ return function()
func = earlyinit
while func do
local _, retval = xpcall(func, deferErrhand)
if retval then return retval end
local _, retval, restartvalue = xpcall(func, deferErrhand)
if retval then return retval, restartvalue end
coroutine.yield()
end