General discussion about LÖVE, Lua, game development, puns, and unicorns.
peaches
Prole
Posts: 9 Joined: Tue Jul 28, 2009 7:47 pm
Post
by peaches » Mon Jan 04, 2010 6:48 pm
Is there a specific reason to use love.load instead of just placing initialization code in the boostrap? e.g.
Code: Select all
local g = love.graphics
function love.load()
g.setBackgroundColor(155, 155, 255)
g.setColor(255, 255, 155)
end
function love.draw()
g.print("Hello, World", 100, 100)
end
vs.
Code: Select all
local g = love.graphics
g.setBackgroundColor(155, 155, 255)
g.setColor(255, 255, 155)
function love.draw()
g.print("Hello, World", 100, 100)
end
Robin
The Omniscient
Posts: 6506 Joined: Fri Feb 20, 2009 4:29 pm
Location: The Netherlands
Contact:
Post
by Robin » Mon Jan 04, 2010 6:54 pm
peaches wrote: Is there a specific reason to use love.load instead of just placing initialization code in the boostrap? e.g.
More obvious than scattering init code all over the place
You could use it to restart your game: depending on what you stuff in love.load(), just call love.load() when you want to reset the game
peaches
Prole
Posts: 9 Joined: Tue Jul 28, 2009 7:47 pm
Post
by peaches » Mon Jan 04, 2010 7:13 pm
Both are achievable without the built-in callback, though. I was more curious, e.g., if the native executable modifies state in between loading the main module and invoking love.run(), (e.g. registering additonal callbacks? inspecting globals?) such that the actual behavior would be different.
Robin
The Omniscient
Posts: 6506 Joined: Fri Feb 20, 2009 4:29 pm
Location: The Netherlands
Contact:
Post
by Robin » Mon Jan 04, 2010 8:02 pm
Nope.
bartbes
Sex machine
Posts: 4946 Joined: Fri Aug 29, 2008 10:35 am
Location: The Netherlands
Contact:
Post
by bartbes » Mon Jan 04, 2010 10:23 pm
I think it might create the window, not sure though.
Robin
The Omniscient
Posts: 6506 Joined: Fri Feb 20, 2009 4:29 pm
Location: The Netherlands
Contact:
Post
by Robin » Tue Jan 05, 2010 7:13 am
bartbes wrote: I think it might create the window, not sure though.
Not in 0.6.0 it doesn't:
http://love2d.org/docs/love_run.html
bartbes
Sex machine
Posts: 4946 Joined: Fri Aug 29, 2008 10:35 am
Location: The Netherlands
Contact:
Post
by bartbes » Tue Jan 05, 2010 7:58 am
That was useless, it proved exactly nothing. Let me look it up.
EDIT: After examining the piece of code that really mattered, the only difference is that the love console (on windows) has not been opened yet.
Users browsing this forum: Bing [Bot] and 0 guests