lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

On 8 February 2017 at 00:09, Dirk Laurie <> wrote:
> 2017-02-07 12:59 GMT+02:00 Javier Guerra Giraldez <>:
>> What I would like is that package.searchpath() would replace another
>> character, like '$' with the directory where the function calling
>> 'request' resides. a crude implementation:
> ...
>> function package.searchpath (name, path, sep, rep)
> Over to you, supporters of the notion. Javier has reduced the problem
> to a mere monkeypatching of one routine in the package library.
> Try it out. Do you like it?

Note that this solution will break due to the string passed to require
being used in package.loaded.
e.g. if you have the 5 files:

myprogram/main.lua containing: `require ""; require "b.qux"`
myprogram/a/foo.lua contaning: `require "base"`
myprogram/b/qux.lua containg: `require "base"`

Then b/qux.lua will *not* get what it expects