Created .exe, when running .exe error unable to load audio 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.
User avatar
Nine Iron
Prole
Posts: 13
Joined: Fri Oct 09, 2020 5:59 am

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

Post 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.
RNavega
Party member
Posts: 252
Joined: Sun Aug 16, 2020 1:28 pm

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

Post 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".
User avatar
pgimeno
Party member
Posts: 3551
Joined: Sun Oct 18, 2015 2:58 pm

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

Post 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?
User avatar
Nine Iron
Prole
Posts: 13
Joined: Fri Oct 09, 2020 5:59 am

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

Post by Nine Iron »

sFile = love.audio.newSource("subfolder/casecorrectfilename.ogg", "static")
User avatar
pgimeno
Party member
Posts: 3551
Joined: Sun Oct 18, 2015 2:58 pm

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

Post 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?
User avatar
Nine Iron
Prole
Posts: 13
Joined: Fri Oct 09, 2020 5:59 am

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

Post by Nine Iron »

Yes, it is set to true in conf.lua.
User avatar
pgimeno
Party member
Posts: 3551
Joined: Sun Oct 18, 2015 2:58 pm

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

Post 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)
User avatar
Nine Iron
Prole
Posts: 13
Joined: Fri Oct 09, 2020 5:59 am

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

Post 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.
User avatar
zorg
Party member
Posts: 3444
Joined: Thu Dec 13, 2012 2:55 pm
Location: Absurdistan, Hungary
Contact:

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

Post 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)?
Me and my stuff :3True Neutral Aspirant. Why, yes, i do indeed enjoy sarcastically correcting others when they make the most blatant of spelling mistakes. No bullying or trolling the innocent tho.
User avatar
pgimeno
Party member
Posts: 3551
Joined: Sun Oct 18, 2015 2:58 pm

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

Post 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().
Post Reply

Who is online

Users browsing this forum: Bing [Bot] and 60 guests