Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Before you make a thread asking for help, read this
- Party member
- Posts: 161
- Joined: Thu Sep 25, 2008 7:04 pm
- Location: France
The wiki said ( http://love2d.org/wiki/Tutorial:Callback_Functions
This function gets called only once, when the game is started, and is usually where you would load resources, initialize variables and set specific settings. All those things can be done anywhere else as well, but doing them here means that they are done once only, saving a lot of system resources.
I remember a way to pause/resume and reload the game in LOVE v0.5.0.
I suppose the reload feature has disappeared in 0.7.1, no problem.
But I don't anderstand how you can "saving a lot of system resources".
If I wrote a main.lua like :
Code: Select all
myvar = "test"
What the resource differences ?
Is it really "a lot" ?
EDIT: subject edited
Last edited by TsT
on Tue Apr 05, 2011 5:10 pm, edited 1 time in total.
- Inner party member
- Posts: 3153
- Joined: Sat Oct 03, 2009 5:22 pm
- Location: Madrid, Spain
I think that intends to mean that "creating resources only once saves a lot of system resources". The opposite would be creating a font on each frame, inside love.update.
But the wording is a bit unfortunate IMHO.
The only difference I can think of between doing it inside love.load and at the top of your main is that you may have a custom love.run function that doesn't call love.load.
When I write def I mean function.
- Inner party member
- Posts: 1260
- Joined: Wed Dec 29, 2010 8:19 pm
- Location: Queensland, Australia
A nice thing about a love.load is that it's called after everything is loaded. So you can place it anywhere inside your main.lua file (or even another file), and it will have proper access to all globals and and that stuff.
But anyway, back on topic. That wording is unfortunate. I agree with kikto that it's probably meaning, "don't put it in something that's called regularly", like love.update or love.draw.
- Sex machine
- Posts: 4944
- Joined: Fri Aug 29, 2008 10:35 am
- Location: The Netherlands
Another thing is, that it can help simulate the old reload feature. If all initializing is done in love.load, calling love.load() should be the same as restarting.
Users browsing this forum: No registered users and 11 guests