|
Hi!One consequence of my proposal for a Lua virtual filesystem layer [1] would be, that the module path could be a) reduced to "/lua/lib"
and b) extended at any moment by a union mount of the path "where the user decides to store her scripts" before or after "/lua/lib".As time permits, I will definitely pursue this path, extending my proof of concept implementation[2].
Regards, Jorge-León [1] http://lua-users.org/lists/lua-l/2011-11/msg00066.html [2] http://sw.magma.com.ni/LuaFs On 11/18/11 09:35, Oliver Mueller wrote:
Duncan's solution would work for exactly the scenario I described in my post...but unfortunately this is not general enough for me. I don't know the path of "scripts" in advance (depends on where the user decides to store her scripts) so I cannot hard code it into the script. I'd need to expand the load path with the path of the directory from which the first lua file is loaded. On Tue, Nov 15, 2011 at 4:33 PM, Peng Zhicheng <pengzhicheng1986@gmail.com> wrote:于 2011-11-15 1:56, Duncan Cross 写道:On Mon, Nov 14, 2011 at 4:47 PM, Oliver Mueller <oliver.mueller@gmail.com> wrote: The load paths are taken from package.path - it is a semicolon-separated string, where a question mark is used to interpolate the package name. So, to look for modules inside the 'scripts/' folder, do this before any calls to require(): package.path = package.path .. ';scripts/?.lua' -Duncanjust to mention, that the seperator/delimiter/placeholder of `package.path' is configurable, not guaranteed to be semicolon or question mark. refer to `package.config' and `luaconf.h' for details.