File not found in .love, require error.

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
Torquil
Prole
Posts: 3
Joined: Thu Oct 21, 2010 2:42 pm

File not found in .love, require error.

Post by Torquil »

When I do a love.filesystem.enumerate to return the contents of a folder it throws an error saying it cannot find the same files when I attempt to 'require' them. I am using 0.8.0 and have attached the .love file. The same code works in 0.7.0 so I think I've probably missed some change to the way it works.
Attachments
WIP.love
(17.87 KiB) Downloaded 110 times
User avatar
Robin
The Omniscient
Posts: 6506
Joined: Fri Feb 20, 2009 4:29 pm
Location: The Netherlands
Contact:

Re: File not found in .love, require error.

Post by Robin »

Replace line 16 and 17 of main.lua with:

Code: Select all

	for k, v in pairs(love.filesystem.enumerate("states")) do love.filesystem.load("states/" .. v)() end --Add all states from folder 'states'
	for k, v in pairs(love.filesystem.enumerate("extensions")) do love.filesystem.load("extensions/" .. v)()  end --Add all extensions from folder 'extensions'
require does not want a file name, but a module name: the module name "foo.bar" translates to the filename "foo/bar.lua". love.filesystem.load, on the other hand, does take a file name, and in this case that all works out.
Help us help you: attach a .love.
Torquil
Prole
Posts: 3
Joined: Thu Oct 21, 2010 2:42 pm

Re: File not found in .love, require error.

Post by Torquil »

That makes sense, thanks for the help.
Post Reply

Who is online

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