Page 2 of 2

Re: Pig Command

Posted: Mon Sep 12, 2011 5:04 pm
by Robin
Guess what? When I unzip it, there are no problems.

This has happened a lot of times before, mostly with middleclass, although it seems to be more of a "can't require in subdirectories" issue.

Strangely, moving middleclass.lua to the main folder and changing the first require to "middlclass" fixes it, even though the middleclass-extra files are still in "lib/middleclass-extra"...

Re: Pig Command

Posted: Mon Sep 12, 2011 5:07 pm
by TechnoCat
Robin wrote:Guess what? When I unzip it, there are no problems.

This has happened a lot of times before, mostly with middleclass, although it seems to be more of a "can't require in subdirectories" issue.

Strangely, moving middleclass.lua to the main folder and changing the first require to "middlclass" fixes it, even though the middleclass-extra files are still in "lib/middleclass-extra"...
I'm willing to bet just doing require 'lib/middleclass/init' will fix it, but I want to load the module package in the correct Lua way.

Re: Pig Command

Posted: Mon Sep 12, 2011 5:14 pm
by T-Bone
TechnoCat wrote:Well, lib/middleclass is the directory, so shouldn't it be looking for lib/middleclass/init.lua? http://www.lua.org/manual/5.1/manual.ht ... ge.loaders
hint: It finds it on the other systems.

Also, why have I never come across this before? Something is fishy in pigland.
I thought it was looking for the file middleclass.lua. But maybe it's init.lua. I've never seen the syntax "require lib.middleclass" before.

Re: Pig Command

Posted: Mon Sep 12, 2011 5:32 pm
by TechnoCat
T-Bone wrote: I thought it was looking for the file middleclass.lua. But maybe it's init.lua. I've never seen the syntax "require lib.middleclass" before.
As stated by PiL:
the search for a Lua file for module foo will try to open the files ./foo.lua, ./foo.lc, and /usr/local/foo/init.lua, in that order.

Re: Pig Command

Posted: Mon Sep 12, 2011 5:35 pm
by T-Bone
TechnoCat wrote:
T-Bone wrote: I thought it was looking for the file middleclass.lua. But maybe it's init.lua. I've never seen the syntax "require lib.middleclass" before.
As stated by PiL:
the search for a Lua file for module foo will try to open the files ./foo.lua, ./foo.lc, and /usr/local/foo/init.lua, in that order.
I guess LÖVE only supports that in .love-files on some systems. Or perhaps it's the part about using dots for folders that confuses it?
Besides, it doesn't say that it checks ./foo/init.lua, which it actually seems to do...?

Re: Pig Command

Posted: Mon Sep 12, 2011 6:26 pm
by bartbes
No slashes in require. No. Periods are correct.
As for the /init.lua, that has been in love since 0.7.0 (at least, I cba to check any further back). That said, I remember changing the loader for 0.8.0, so maybe that behaves better?

Re: Pig Command

Posted: Tue Sep 13, 2011 3:05 pm
by kikito
For the record, on the next version of middleclass, I'll ditch the init.lua file entirely; you will just use the middleclass.lua file. This will hopefully sidestep these issues.