[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Lua Unofficial FAQ Addition
- From: steve donovan <steve.j.donovan@...>
- Date: Thu, 6 Oct 2011 10:04:13 +0200
On Wed, Oct 5, 2011 at 7:36 PM, Rob Hoelz <email@example.com> wrote:
> "How do I tell require to search relative to the current module?"
It's a good question, because it illuminates the central role of package.path.
The solution I use is to look at _G.arg and work out the base path
from that; this seems to work fine and is the basis for
app.require_here() in Penlight: Then we modify package.(c)path
(If anybody _could_ see a potential problem with this method I would
I've seen people use debug information of the main script to find this
out, but I can't see any advantages of this. It would not work if
debug information had been stripped, for instance.