lua-users home
lua-l archive

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


On Thu, Sep 22, 2011 at 1:33 AM, Dirk Laurie <dpl@sun.ac.za> wrote:
> Maybe an even better solution would thus be to omit the current directory
> altogether from the default path.

That could be more correct.  Some programs like LuaRocks do things
like `local lfs_ok, lfs = pcall(require, "lfs")` to test whether a
module exists and conditionally use it [1].  If luafilesystem is not
installed and there happens to be a file named "lfs.lua" in the
current directory (even if it's intended to map to another module name
like "foo.bar.lfs"), then LuaRocks fails:

  $ touch lfs.lua
  $ luarocks
  /usr/bin/lua: <...>/luarocks/fs/lua.lua:161: attempt to index
upvalue 'lfs' (a boolean value)

[1] https://github.com/keplerproject/luarocks/blob/master/src/luarocks/fs/lua.lua