lua-users home
lua-l archive

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


It was thus said that the Great Abhijit Nandy once stated:
> So why aren't the paths from where the modules are loaded, simply kept in a
> table mapped to the module name?

  Let's assume this happens.  package.locations[] contains the path from
where a given module was loaded from.  What types of checks could one
realistically do given this information?  On my system, a module can appear
in one of these paths:

	/home/spc/.luarocks/share/lua/5.3/
	/home/spc/.luarocks/lib/lua/5.3/
	/usr/local/share/lua/5.3/
	/usr/local/lib/lua/5.3/
	./

  For a program I'm using, yes, I can check to see if module complex was
loaded from "/home/spc/.luarocks/share/lua/5.3/complex.lua" but I can't
release it that way for others to use.

  Another issue I've encountered is with a module installed in multiple
locations.  Granted, this is something I do to myself.  I make a change to
one of my modules and install it from source where it's installed to
"/usr/local/share/lua/5.3/".  But I forgot that I installed it from LuaRocks
the last time I released it (to make sure it works via LuaRocks) and the
previous version is in "/home/spc/.luarocks/share/lua/5.3/", which is listed
first in package.path.  And I wonder why the new code isn't working ...

  -spc