Page 1 of 1

Game cannot find files when packaged as a .love file

Posted: Sat Aug 08, 2020 8:34 pm
by DPS2004
Hello.

It seems when I package my game as a .love file, love2d has trouble finding files within it. If I run the game directly from main.lua or from the folder, it runs just fine. But when I try to run it from the .love file: I get the following error.

Code: Select all

Error

cannot open obj/bootscreen/sweep.lua: No such file or directory


Traceback

[C]: in function 'dofile'
states/bootscreen.lua:15: in function '__NULL__'
lib/gamestate.lua:43: in function 'switch'
main.lua:103: in function 'load'
[C]: in function 'xpcall'
[C]: in function 'xpcall'
This does not make much sense, since if I unzip the .love file or look in it using 7zip, I see that the file does exist. Image

Any help is appreciated.

Re: Game cannot find files when packaged as a .love file

Posted: Sat Aug 08, 2020 9:12 pm
by grump
dofile doesn't know how to load from .love files. Use love.filesystem.load or loadstring, or require.

Re: Game cannot find files when packaged as a .love file

Posted: Sat Aug 08, 2020 9:41 pm
by DPS2004
Thank you so much for the answer!