.love file package/require path

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

Re: .love file package/require path

Post by bartbes »

Well, you know, I did implement it. Specifically, love adds a loader, it doesn't replace the lua loaders. And package.path does influence the lua loaders, just not the love's. I know, it's a bit annoying. So in this case, running it unpacked means the lua loaders find it, and I'm betting you're running the .love from the same folder, hence it loading the files from the directory it is in, rather than the .love itself.

As for the source, the loader is defined in https://bitbucket.org/rude/love/src/0.1 ... em.cpp-608, where you can see it calls getRequirePath, rather than reading package.path.
User avatar
jerluc
Prole
Posts: 13
Joined: Fri Mar 25, 2016 9:59 pm
Location: San Francisco, CA
Contact:

Re: .love file package/require path

Post by jerluc »

@bartbes thanks for the info! And yeah, that makes a lot more sense now. Also, thanks for the link to the source code. Maybe it's just me, but I find that reading the source seems to be way more clarifying and insightful than what some of the wiki docs say.
User avatar
airstruck
Party member
Posts: 650
Joined: Thu Jun 04, 2015 7:11 pm
Location: Not being time thief.

Re: .love file package/require path

Post by airstruck »

jerluc wrote:Maybe it's just me, but I find that reading the source seems to be way more clarifying and insightful than what some of the wiki docs say.
Just wait til you try love.physics...
User avatar
slime
Solid Snayke
Posts: 3160
Joined: Mon Aug 23, 2010 6:45 am
Location: Nova Scotia, Canada
Contact:

Re: .love file package/require path

Post by slime »

airstruck wrote:Just wait til you try love.physics...
http://box2d.org/manual.pdf is decent documentation for love.physics.
User avatar
airstruck
Party member
Posts: 650
Joined: Thu Jun 04, 2015 7:11 pm
Location: Not being time thief.

Re: .love file package/require path

Post by airstruck »

slime wrote:http://box2d.org/manual.pdf is decent documentation for love.physics.
It's great for figuring out how to use Box2D, I've had it open in a tab for weeks. I was talking more about using the wiki as an API reference for love.physics (still needed since the APIs differ and not everything in the Box2D API is exposed to love.physics). There are a lot of undocumented things, and some things are documented that were removed years ago. I've been using the wrap_Foo.cpp source files as API documentation instead of the wiki, since I found myself having to check the source after reading the wiki anyway to be sure the stuff I want to use is actually there, that I'm not overlooking things that aren't documented, and that when the wiki says, for example, that something is measured in meters per second or Newtons, it is actually measured in those units (I've been bitten by all three of those things).

For the most part I think the wiki does a pretty decent job of documenting Love's API, but the love.physics section could be better.
User avatar
slime
Solid Snayke
Posts: 3160
Joined: Mon Aug 23, 2010 6:45 am
Location: Nova Scotia, Canada
Contact:

Re: .love file package/require path

Post by slime »

airstruck wrote:For the most part I think the wiki does a pretty decent job of documenting Love's API, but the love.physics section could be better.
Indeed! Anyone with a forum account can edit the wiki – please contribute if you're willing and able. :)
User avatar
airstruck
Party member
Posts: 650
Joined: Thu Jun 04, 2015 7:11 pm
Location: Not being time thief.

Re: .love file package/require path

Post by airstruck »

slime wrote:Indeed! Anyone with a forum account can edit the wiki – please contribute if you're willing and able. :)
Wiki editing is not usually my thing, but I'd be willing to go through and get the love.physics section up to date. I do think love.physics will be infinitely more useful when worlds can be serialized properly, though. I'd like to see what happens with relevant tickets (currently #1191 and #1194) before editing the wiki, so it can all be done in one shot. I'll also do whatever I can to help get those issues resolved.
Post Reply

Who is online

Users browsing this forum: Google [Bot] and 2 guests