My code runs fine when I run the folder through the Love exe (windows), however when I zip it (and rename it to a .love file), it gives an error about being unable to find module "middleclass.init" (which I am using in my code). The error does not occur when I place my .love file inside my game's directory.
Am I doing it wrong?
Require error after zipping folder into .love file
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
- slime
- Solid Snayke
- Posts: 3144
- Joined: Mon Aug 23, 2010 6:45 am
- Location: Nova Scotia, Canada
- Contact:
Require error after zipping folder into .love file
- Attachments
-
- spacegame.love
- (186.05 KiB) Downloaded 96 times
- Taehl
- Dreaming in associative arrays
- Posts: 1025
- Joined: Mon Jan 11, 2010 5:07 am
- Location: CA, USA
- Contact:
Re: Require error after zipping folder into .love file
Make sure your filepaths are written UNIX-style. You didn't use backslashes ("\") instead of forwardslashes ("/"), did you?
Earliest Love2D supporter who can't Love anymore. Let me disable pixel shaders if I don't use them, dammit!
Lenovo Thinkpad X60 Tablet, built like a tank. But not fancy enough for Love2D 0.10.0+.
Lenovo Thinkpad X60 Tablet, built like a tank. But not fancy enough for Love2D 0.10.0+.
- kikito
- Inner party member
- Posts: 3153
- Joined: Sat Oct 03, 2009 5:22 pm
- Location: Madrid, Spain
- Contact:
Re: Require error after zipping folder into .love file
Also, make sure your filenames have exactly the same case.
If you require 'Foo.lua' inside windows, but the file is called foo.lua, it will work on windows uncompressed, but once you zip that, it'll stop working.
If you require 'Foo.lua' inside windows, but the file is called foo.lua, it will work on windows uncompressed, but once you zip that, it'll stop working.
When I write def I mean function.
- Robin
- The Omniscient
- Posts: 6506
- Joined: Fri Feb 20, 2009 4:29 pm
- Location: The Netherlands
- Contact:
Re: Require error after zipping folder into .love file
It's none of those. I've looked at the code, and it only wants to run if LÖVE can find middleclass in the current directory. I don't know whether it's Lua's fault, or LÖVE's, or perhaps even Middleclass's, but slime's code seems to be clear.
Help us help you: attach a .love.
Re: Require error after zipping folder into .love file
Looks like physfs bug:
If you rename middleclass-extras to xiddleclass-extras (and change main.lua accordingly) then everything works OK.
Should by reported upstream. I think physfs does not like directories with similar names.
Code: Select all
$ test_physfs
> mount spacegame2.love / 0
Successful.
> ls /
...
middleclass
middleclass-extras
..
total (14) files.
> ls middleclass
BSD-LICENSE.txt
README.textile
init.lua
middleclass.lua
total (4) files.
> exists middleclass/init.lua
File does not exists.
> exists middleclass-extras/init.lua
File exists.
Should by reported upstream. I think physfs does not like directories with similar names.
My lovely code lives at GitHub: http://github.com/miko/Love2d-samples
- bartbes
- Sex machine
- Posts: 4946
- Joined: Fri Aug 29, 2008 10:35 am
- Location: The Netherlands
- Contact:
Re: Require error after zipping folder into .love file
Now that I think of it.. maybe physfs uses 8.3-style name matching? I say this because this isn't the first time we stumbled upon this, and if it only checks the first 8 or 11 characters it would make a lot more sense.
- TechnoCat
- Inner party member
- Posts: 1611
- Joined: Thu Jul 30, 2009 12:31 am
- Location: Denver, CO
- Contact:
Re: Require error after zipping folder into .love file
Debugging these errors could be a nightmare then. No way to tell what is really happening.bartbes wrote:Now that I think of it.. maybe physfs uses 8.3-style name matching? I say this because this isn't the first time we stumbled upon this, and if it only checks the first 8 or 11 characters it would make a lot more sense.
- slime
- Solid Snayke
- Posts: 3144
- Joined: Mon Aug 23, 2010 6:45 am
- Location: Nova Scotia, Canada
- Contact:
Re: Require error after zipping folder into .love file
Alright thanks, changing the name did the trick.miko wrote:Looks like physfs bug:If you rename middleclass-extras to xiddleclass-extras (and change main.lua accordingly) then everything works OK.Code: Select all
...
Should by reported upstream. I think physfs does not like directories with similar names.
- kikito
- Inner party member
- Posts: 3153
- Joined: Sat Oct 03, 2009 5:22 pm
- Location: Madrid, Spain
- Contact:
Re: Require error after zipping folder into .love file
This is weird.
I mean, middleclass-extras has been already used in other .love files, hasn't it?
I mean, middleclass-extras has been already used in other .love files, hasn't it?
When I write def I mean function.
- TechnoCat
- Inner party member
- Posts: 1611
- Joined: Thu Jul 30, 2009 12:31 am
- Location: Denver, CO
- Contact:
Re: Require error after zipping folder into .love file
I just drop anything I use in middleclass-extras/ into libs/middleclass/ to be honest.kikito wrote:This is weird.
I mean, middleclass-extras has been already used in other .love files, hasn't it?
Who is online
Users browsing this forum: No registered users and 6 guests