Build crashes when dropping onto love.exe, but not through sublime

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.
Post Reply
JJSax
Prole
Posts: 5
Joined: Fri Apr 04, 2014 3:59 am

Build crashes when dropping onto love.exe, but not through sublime

Post by JJSax » Fri Nov 09, 2018 7:18 am

I use sublime to launch my program using ctrl+b. It works great. But when I drag and drop the folder onto love.exe, it crashes.

This is a simplified section of the code the error is occurring at.

Code: Select all

function love.conf(a)
	a.console = true
	checkConfig() -- checkConfig is defined elsewhere
	config = table.load("Files/config.lua") -- table.load() is defined elsewhere
	
	print(config) -- This prints "table: 0x3dd9da18" when I ctrl+b.  But drag drop, it does nothing.
	     -- Even when I print("Hello") nothing happens when dragging it, but works exactly as expected with ctrl+b
	a.window.width = config.window.width -- This is the line it crashes on.  error says config is returning nil. 
end -- it doesn't actually end here.  I took out a lot for simplicity sake.
I have double and triple checked paths. The directory in the title of the document I'm editing in sublime is precisely the one I'm dragging.
Attachments
TextDisplay.love
(21.43 KiB) Downloaded 3 times

grump
Party member
Posts: 432
Joined: Sat Jul 22, 2017 7:43 pm

Re: Build crashes when dropping onto love.exe, but not through sublime

Post by grump » Fri Nov 09, 2018 8:05 am

settings.lua uses io.open among other io functions. They won't work properly with LÖVE, in this example it's probably not finding relative paths due to the working directory not being correct. Use love.filesystem instead. I'd replace settings.lua entirely with a better serialization solution.

JJSax
Prole
Posts: 5
Joined: Fri Apr 04, 2014 3:59 am

Re: Build crashes when dropping onto love.exe, but not through sublime

Post by JJSax » Fri Nov 09, 2018 8:08 am

grump wrote:
Fri Nov 09, 2018 8:05 am
settings.lua uses io.open among other io functions. They won't work properly with LÖVE, in this example it's probably not finding relative paths due to the working directory not being correct. Use love.filesystem instead. I'd replace settings.lua entirely with a better serialization solution.
oh. Dang, that is the one I found that does what I need it to. Any recommendations on how I can save a table to a file to be easily recalled as the same table. something similar to what I'm doing here.

also thanks for that information. I didn't realize that lua function doesn't work with love2d.


User avatar
zorg
Party member
Posts: 2413
Joined: Thu Dec 13, 2012 2:55 pm
Location: Absurdistan, Hungary
Contact:

Re: Build crashes when dropping onto love.exe, but not through sublime

Post by zorg » Fri Nov 09, 2018 9:04 am

JJSax wrote:
Fri Nov 09, 2018 8:08 am
also thanks for that information. I didn't realize that lua function doesn't work with love2d.
Technically it does work, you just need to be aware of the limitations and caveats; bottom line, it's easier and simpler in most cases to just use love.filesystem stuff.
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.

Post Reply

Who is online

Users browsing this forum: Ulydev and 6 guests