lua-users home
lua-l archive

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


On Thu, Jan 31, 2019 at 3:01 PM Roberto Ierusalimschy wrote:
> Function "require" with empty module name
>    require("")
> actually loads the module "init.lua" from your Lua modules forder.

What is the path (package.path)?



This feature works with the default value of (package.path).

The gist of this quirk is that both Linux and Windows
ignore superfluous path separators.
For example, the following file
   ~/My_Lua_Scripts/howling.at.the.lua
is accessible also through another path:
   ~///My_Lua_Scripts////////howling.at.the.lua

So, the pattern
   /usr/local/share/lua/5.3/?/init.lua
after replacing "?" with empty string becomes
   /usr/local/share/lua/5.3//init.lua
which is equivalent (from the OS viewpoint) to
   /usr/local/share/lua/5.3/init.lua