[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Location of a package
- From: Roberto Ierusalimschy <roberto@...>
- Date: Mon, 18 Feb 2008 17:19:33 -0300
> It's unfortunate that the package finder function isn't exposed in Lua by
> the native package lib. I hope it will be done
> in Lua 5.2.
>
> Metalua needs it, and reimplements it. Look at function package.findfile()in
> http://repo.or.cz/w/metalua.git?a=blob_plain;f=src/lib/package2.lua, and
> give it your package's name as first arg,
> package.cpath or package.path as a second arg, depending on whether your
> module is in C or in Lua. Don't
> forget to close the file handle if you don't use it.
Lua 5.2 will include a package.searchpath function. It is similar
to this package.findfile, but it returns only the file name (not the
file handler).
-- Roberto