lua-users home
lua-l archive

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


Здравствуйте, Milind.

Вы писали 21 сентября 2015 г., 23:44:04:

> Hi,
>       Currently if package.path has a path like:

> C:\a\b\c\..\?\d\?.lua

> Then it require("mod") searches for

> C:\a\b\c\..\mod\d\mod.lua  -> C:\a\b\mod\d\mod.lua

> This is good.

> require("mod.submod") searches for

> C:\a\b\c\..\mod\submod\d\mod\submod.lua

> It would be much better I think if it searched:

> C:\a\b\c\..\mod\d\mod\submod.lua

> It can be achieved by adding a custom searcher in the
> package.searchers but wouldn't it support a better hierarchy of code
> if the existing searcher did that?

> Thanks,
> Milind

I   use   just   that.   I   use  lua_init  env  variable  to  set  my
pakage.loaders/searchrs.   I   use   strings   for   pakage.path   like
`*\share\?.lua;lua*\share\?.lua;lua-*\share\?.lua`.  Where  `*` is lib
name  which calculate as first part in require argument. This does not
works  for  some modules like `mime` from luasocket or `re` from lpeg.
for  such  modules  i  have table to associate them with library. Also
my loadrs update %PATH% env variable for current process. So I have
separate directory for library which contain `share` dir with all
modules,  `test`  dir  with  tests,  `doc`  dir with documentation and
`path`  dir with external deps (e.g. libuv.dll for lluv or zmq.dll for
lzmq). `path` adds to process env %path% variable just before loading lua
module.  So  you  can use specific version for lua module. E.g. I have
several  openssl  in  my  %PATH%  but  lua module have to use specific
version.


--
С уважением,
 Alexey                          mailto:alexeymelnichuck@gmail.com


---
Это сообщение проверено на вирусы антивирусом Avast.
https://www.avast.com/antivirus