[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: extending lua load path
- From: Oliver Mueller <oliver.mueller@...>
- Date: Fri, 18 Nov 2011 09:42:08 +0100
nice, this comes very close to the ruby version...a little more
verbose but it will work for me.
On Tue, Nov 15, 2011 at 2:36 AM, David Manura <email@example.com> wrote:
> On Mon, Nov 14, 2011 at 11:47 AM, Oliver Mueller
> <firstname.lastname@example.org> wrote:
>> One script requires another like this:
>> 1.script ("scripts/myscript.lua"):
>> require('base') ...
>> 2.script ("scripts/base.lua"): ...
>> But when I call it from anywhere else, the require "base" is not found:
> My findbin and lib [1,2] modules (based on analogous modules from
> Perl) had that in mind:
> -- /qux/bar/baz.lua
> print(require 'findbin'.bin) --> prints directory of script (/qux/bar)
> require 'lib' (require 'findbin' '/../lib')
> -- adds a path relative to the directory of the current script to the
> -- package search paths (package.path & package.cpath).
> require 'foo' -- loads from new search paths (/qux/lib/foo.lua)
>  https://gist.github.com/1342319
>  https://gist.github.com/1342365
tel +49 163 680 7658