Page 1 of 1

Purpose of love.load() vs top of main.lua

Posted: Thu Apr 27, 2023 5:52 am
by ernmalley
The love documentation does not make it clear when you should use the love.load() callback versus just putting your initialization code at the top of the main.lua file. I know that love.load gives you access to the command line arguments and that you can declare local variables that will be accessible throughout the various callbacks at the top of the script but not in love.load, but apart from that, what is the difference?
I suppose my point is, what is the use of love.load() apart from giving access to the command line arguments?

Re: Purpose of love.load() vs top of main.lua

Posted: Thu Apr 27, 2023 1:42 pm
by slime
love.load had more of a purpose in some older love versions because some things used to be initialized after main.lua is loaded and before love.load is called. But most or all of those have been changed to initialize earlier in modern love versions, so love.load isn't too useful these days if you don't need parsed command line arguments. (the global arg table also has un-parsed CLI args.)

Re: Purpose of love.load() vs top of main.lua

Posted: Fri Apr 28, 2023 12:40 am
by ernmalley
Thanks for the clarification.