File not found in .love, require error.
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
File not found in .love, require error.
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
- 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.
Replace line 16 and 17 of main.lua with:
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.
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'
Help us help you: attach a .love.
Re: File not found in .love, require error.
That makes sense, thanks for the help.
Who is online
Users browsing this forum: Bing [Bot] and 4 guests