What is a nifty way to make your LOVE app restart properly?
(Win / Linux / Mac OS)
I'm working on a screen res/ratio settings and dont want to
have deal with much of dynamical calculations. So.
What is a nifty way to make your LOVE app restart?
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
What is a nifty way to make your LOVE app restart?
Our LÖVE Gamedev blog Zabuyaki (an open source retro beat 'em up game). Twitter: @Zabuyaki.
LÖVE & Lua Video Lessons in Russian / Видео уроки по LÖVE и Lua
LÖVE & Lua Video Lessons in Russian / Видео уроки по LÖVE и Lua
Re: What is a nifty way to make your LOVE app restart?
Do you mean restarting the game inside the running application, or do you mean quitting the whole thing and then starting it from scratch with a new resolution?
Re: What is a nifty way to make your LOVE app restart?
I'd like to have "restarting inside the running application"Plu wrote:Do you mean restarting the game inside the running application, or do you mean quitting the whole thing and then starting it from scratch with a new resolution?
with the same effect as starting it from scratch.
To make the app re-read config.lua and init all the Love2d inner stuff.
Our LÖVE Gamedev blog Zabuyaki (an open source retro beat 'em up game). Twitter: @Zabuyaki.
LÖVE & Lua Video Lessons in Russian / Видео уроки по LÖVE и Lua
LÖVE & Lua Video Lessons in Russian / Видео уроки по LÖVE и Lua
- zorg
- Party member
- Posts: 3465
- Joined: Thu Dec 13, 2012 2:55 pm
- Location: Absurdistan, Hungary
- Contact:
Re: What is a nifty way to make your LOVE app restart?
While, to my knowledge, calling love.load love.run manually to restart the game would be the preferred way, unless you also load in conf.lua manually yourself, beforehand, and parse the settings, it won't do that by itself.
Me and my stuff True Neutral Aspirant. Why, yes, i do indeed enjoy sarcastically correcting others when they make the most blatant of spelling mistakes. No bullying or trolling the innocent tho.
Re: What is a nifty way to make your LOVE app restart?
This is undocumented afaict but you can call love.init() to re-do the conf.lua part:
https://bitbucket.org/rude/love/src/88e ... ot.lua-331
To actually reload conf.lua so it reflects your changes, you'll first have to zero it out, like any other lua module, using
https://bitbucket.org/rude/love/src/88e ... ot.lua-331
To actually reload conf.lua so it reflects your changes, you'll first have to zero it out, like any other lua module, using
Code: Select all
package.loaded["conf"] = nil
Re: What is a nifty way to make your LOVE app restart?
zorg, alloyed thank you!
I'll try it and watch over the memory usage and stuff.
Thank you. This is a good point to start.
I'll try it and watch over the memory usage and stuff.
Thank you. This is a good point to start.
Our LÖVE Gamedev blog Zabuyaki (an open source retro beat 'em up game). Twitter: @Zabuyaki.
LÖVE & Lua Video Lessons in Russian / Видео уроки по LÖVE и Lua
LÖVE & Lua Video Lessons in Russian / Видео уроки по LÖVE и Lua
- kikito
- Inner party member
- Posts: 3153
- Joined: Sat Oct 03, 2009 5:22 pm
- Location: Madrid, Spain
- Contact:
Re: What is a nifty way to make your LOVE app restart?
If you are careful about where and when your game stores state, you could re-start it by just invoking love.load() manually. But this requires being really organized and strict with your code.
When I write def I mean function.
- slime
- Solid Snayke
- Posts: 3162
- Joined: Mon Aug 23, 2010 6:45 am
- Location: Nova Scotia, Canada
- Contact:
Re: What is a nifty way to make your LOVE app restart?
LÖVE 0.10.2 will have the ability to call love.event.quit("restart") which will effectively do a full restart (including destroying the entire Lua instance and starting a new one). However if you just want to be able to change settings mid-game I recommend writing the game in such a way that you don't need to restart for the new settings to take effect.
Re: What is a nifty way to make your LOVE app restart?
))) So true.slime wrote:LÖVE 0.10.2 will have the ability to call love.event.quit("restart") which will effectively do a full restart (including destroying the entire Lua instance and starting a new one). However if you just want to be able to change settings mid-game I recommend writing the game in such a way that you don't need to restart for the new settings to take effect.
Our LÖVE Gamedev blog Zabuyaki (an open source retro beat 'em up game). Twitter: @Zabuyaki.
LÖVE & Lua Video Lessons in Russian / Видео уроки по LÖVE и Lua
LÖVE & Lua Video Lessons in Russian / Видео уроки по LÖVE и Lua
Who is online
Users browsing this forum: Ahrefs [Bot], Google [Bot] and 3 guests