Difference Between love.load() and Top of File?

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Post Reply
EchoFive
Prole
Posts: 2
Joined: Sat May 03, 2014 5:20 pm

Difference Between love.load() and Top of File?

Post by EchoFive »

What's the difference between love.load() and the top of the file? To my understanding, the main.lua file is only run once, so wouldn't the top of the file be equivalent to putting the same data in love.load()? If so, what is the purpose of love.load()?
khamarr3524
Prole
Posts: 41
Joined: Thu Sep 05, 2013 8:48 pm

Re: Difference Between love.load() and Top of File?

Post by khamarr3524 »

I believe one of the main points is that with love.load you can pass command line arguments to Love.

Please see: http://www.love2d.org/wiki/love.load This is where I got the information.
User avatar
DaedalusYoung
Party member
Posts: 413
Joined: Sun Jul 14, 2013 8:04 pm

Re: Difference Between love.load() and Top of File?

Post by DaedalusYoung »

Also, technically, you can be sure that all love.* functions exist when love.load is called, or something like that I read somewhere.
User avatar
T-Bone
Inner party member
Posts: 1492
Joined: Thu Jun 09, 2011 9:03 am

Re: Difference Between love.load() and Top of File?

Post by T-Bone »

The difference, as far as I know, is that some things might not be fully loaded when you run stuff at the top of the file. Another benefit of using love.load is that you can restart the game by calling love.load again.
Post Reply

Who is online

Users browsing this forum: No registered users and 3 guests