• Subject: Location of a package
• From: Ignacio Burgueño <ignaciob@...>
• Date: Mon, 18 Feb 2008 17:21:18 -0300

Hi everyone.

Is it possible for a module to know where it is placed when being required? I mean, if I have several places specified in my package.path, I'd like the module to be aware of where it was picked up from. That's because I want my module to be able to construct full pathnames pointing to files in subdirectories.


If the answer is 'no', or 'no unless you patch Lua', then do you have any suggestions on how to deal with "resource files"? If my module is at c:\foo\bar\myModule.lua, I need to load files from c:\foo\bar\resource.txt or c:\foo\bar\blah.jpg, and the only path I'd like to configure is the one I set in package.path, so I can't hard-code the paths in myModule.lua


Also, I can't rely on parsing the package.path, since I might remove the path I used to require my module.

Regards,
Ignacio Burgueño