lua-users home
lua-l archive

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


2013/12/6 Robert Virding <robert.virding@erlang-solutions.com>:
> Yes, it is clearer. The current sentence implies that used to FIND a loader and not that it is used BY a loader. Require doesn't directly know about files although it does know about an extra argument apart from the module name which is passed in the call to the loader.

I think you're confusing some concepts here. The path is not used "BY
a loader". The path is used "BY a searcher to FIND a loader". The
loader is not aware of the path.

The loader is not the code finding or compiling the module, the loader
is the module init function (luaopen_ in C or the module script body
in Lua). The function finding loaders, compiling them (if necessary)
and returning them to require is called a searcher.