Page 2 of 3

Re: Created .exe, when running .exe error unable to load audio file

Posted: Sat Oct 10, 2020 4:05 pm
by Nine Iron
It looks like the issue with my font was due to letter case. I corrected that, uncommented my font calls and created another exe.

After creating the exe I moved my .love file to my desktop. The .love still runs outside of my project folder and outside of the love folder. When creating the exe, my love file does need to be in the love folder with love.exe, right?

The exe still won't run, but I don't get an error for my font anymore. It gives me:

'Error

objects/sound.lua:1: attempt to index field 'audio' (a nil value)


Traceback

objects/sound.lua:1: in main chunk
[C]: in function 'require'
main.lua:60: in function 'requireFiles'
main.lua:18: in function 'load'
main.lua:66: in function <main.lua:64>
[C]: in function 'xpcall'
[C]: in function 'xpcall''

Is there anything I'm required to do after creating the exe? Right now I'm just letting it sit in the love folder with love.exe. I've tried moving it to my project folder and after copying all the dlls in the love folder, it gives me the same error.

Re: Created .exe, when running .exe error unable to load audio file

Posted: Sat Oct 10, 2020 6:21 pm
by RNavega
Nine Iron wrote: Sat Oct 10, 2020 4:05 pmWhen creating the exe, my love file does need to be in the love folder with love.exe, right?
As far as I know there's two ways of running your LÖVE games:
  1. Command-line:
    • love.exe "path/to/folder" (running the main script directly, it should be inside /folder/)
    • love.exe "other/path/to/myGame.love" (running the main script inside the top level of the .love archive)
  2. Embedding the .love within the love.exe, then distributing this modified .exe alongside the auxiliary DLLs.
    So the game distribution in this case looks like this:
    • My-Super-Duper-Game-v1.0.0.exe (modified exe with the embedded .love)
    • SDL2.dll
    • love.dll
    • ... (other DLL files)
Edit: Fixed step #1, it's actually the path to the folder, not the path to "main.lua".

Re: Created .exe, when running .exe error unable to load audio file

Posted: Sat Oct 10, 2020 8:22 pm
by pgimeno
Nine Iron wrote: Sat Oct 10, 2020 4:05 pm objects/sound.lua:1: attempt to index field 'audio' (a nil value)
This is the first time we get to see an error message. So, the first line of objects/sound.lua has something that upsets the interpreter, and it may well not be due to a problem with a file. What does that line look like?

Re: Created .exe, when running .exe error unable to load audio file

Posted: Sun Oct 11, 2020 1:05 am
by Nine Iron
sFile = love.audio.newSource("subfolder/casecorrectfilename.ogg", "static")

Re: Created .exe, when running .exe error unable to load audio file

Posted: Sun Oct 11, 2020 1:12 am
by pgimeno
Well, that's intriguing. What the error message is saying, is that love.audio is not defined (but love is).

Do you have the audio module enabled in conf.lua?

Re: Created .exe, when running .exe error unable to load audio file

Posted: Sun Oct 11, 2020 1:21 am
by Nine Iron
Yes, it is set to true in conf.lua.

Re: Created .exe, when running .exe error unable to load audio file

Posted: Sun Oct 11, 2020 1:37 am
by pgimeno
Hmm, perhaps you're missing a DLL or something like that. I don't have experience with Windows, sorry.

"Once you have your game executable you can pack it together with all the other DLL files of the official LÖVE .zip file into a new .zip file and share this with the world."

https://love2d.org/wiki/Game_Distribution (emphasis added)

Re: Created .exe, when running .exe error unable to load audio file

Posted: Sun Oct 11, 2020 2:37 am
by Nine Iron
I appreciate the help. I had all the dlls from the zip file with the exe.

I ended up just removing the sound.lua file from the folder it was in and setting it with main.lua. It runs now.

Re: Created .exe, when running .exe error unable to load audio file

Posted: Sun Oct 11, 2020 9:00 am
by zorg
Nine Iron wrote: Sun Oct 11, 2020 2:37 am I appreciate the help. I had all the dlls from the zip file with the exe.

I ended up just removing the sound.lua file from the folder it was in and setting it with main.lua. It runs now.
i'm still interested though; can you share your sound.lua ('s contents)?

Re: Created .exe, when running .exe error unable to load audio file

Posted: Sun Oct 11, 2020 10:59 am
by pgimeno
If it was the first line of the file, it means that the contents don't matter; the problem was already present when getting there.

The only possible explanation I can think of is that some part of the code removed 'audio' from the love table. It would be interesting to see function requireFiles().