milon wrote: ↑Tue Jun 01, 2021 2:18 pm
Please tell me more about your issue with love.load.
Sure.
love.load is a constant source of confusion for newbies, and encourages them to make bad decisions.
love.load has no real purpose. Everything you do in love.load you can do at the top level of main.lua instead.
love.load looks like you should use it for resource initialization. Which would be fine, if it wasn't for the temptation to make all your resources global out of convenience. Doing it right is more work and requires a deeper understanding of scope if you use love.load: You have to declare your locals in the parent scope before you initialize them in love.load, or they end up being global. You can just as well initialize them in the parent scope, ignore love.load, write less code that has fewer bugs, and still get the same results.
love.load is thought of as a magic "restart game" mechanism by some people: just call love.load and your game restarts. This can and will end badly, because calling love.load does not reset global state, and it's not meant to be called manually.
The only thing that love.load really does is give you a local copy of (or reference to, I don't remember) the command line arguments. But you can access those through the global
arg just as well from anywhere you need them (which is also not the best design decision, and probably a remnant from the early days).
I'm not a huge fan of love.load.