What is the point of love.load?
Posted: Wed Jan 04, 2017 6:03 pm
I already know lua pretty well and last night I decided to learn to use Love2D, and I just have a quick question about love.load
I tried looking up the answer myself, but all I got was things saying what it does (Runs once at the very start of your code)
Why should I do this
and not this
The only thing the love.load key seems to change is I can't just local variables (Since they will be local to the load function)
Is it just about keeping things organized, or does love.load actually do something special that means I should use it?
I tried looking up the answer myself, but all I got was things saying what it does (Runs once at the very start of your code)
Why should I do this
Code: Select all
function love.load()
example = "Hello world."
end
function love.update(elapse)
end
function love.draw()
love.graphics.print(example)
end
Code: Select all
local example = "Hello world."
function love.update(elapse)
end
function love.draw()
love.graphics.print(example)
end
Is it just about keeping things organized, or does love.load actually do something special that means I should use it?