Pig Command

Show off your games, demos and other (playable) creations.
User avatar
Robin
The Omniscient
Posts: 6506
Joined: Fri Feb 20, 2009 4:29 pm
Location: The Netherlands
Contact:

Re: Pig Command

Post 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"...
Help us help you: attach a .love.
User avatar
TechnoCat
Inner party member
Posts: 1611
Joined: Thu Jul 30, 2009 12:31 am
Location: Denver, CO
Contact:

Re: Pig Command

Post 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.
User avatar
T-Bone
Inner party member
Posts: 1492
Joined: Thu Jun 09, 2011 9:03 am

Re: Pig Command

Post 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.
User avatar
TechnoCat
Inner party member
Posts: 1611
Joined: Thu Jul 30, 2009 12:31 am
Location: Denver, CO
Contact:

Re: Pig Command

Post 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.
User avatar
T-Bone
Inner party member
Posts: 1492
Joined: Thu Jun 09, 2011 9:03 am

Re: Pig Command

Post 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...?
User avatar
bartbes
Sex machine
Posts: 4946
Joined: Fri Aug 29, 2008 10:35 am
Location: The Netherlands
Contact:

Re: Pig Command

Post 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?
User avatar
kikito
Inner party member
Posts: 3153
Joined: Sat Oct 03, 2009 5:22 pm
Location: Madrid, Spain
Contact:

Re: Pig Command

Post 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.
When I write def I mean function.
Post Reply

Who is online

Users browsing this forum: HRA and 58 guests