Re: Can a Lua module find out whether it is being required or dofiled?
[
Date Prev][
Date Next][
Thread Prev][
Thread Next]
[
Date Index]
[
Thread Index]
- Subject: Re: Can a Lua module find out whether it is being required or dofiled?
- From: Jerome Vuarand <jerome.vuarand@...>
- Date: 2015年9月23日 16:06:23 +0100
2015年09月23日 15:15 GMT+01:00 Dirk Laurie <dirk.laurie@gmail.com>:
> I have never understood what the manual means by "loader".
> Is "mymod.lua" a loader for the module "mymod"?
Yeah, in a sense. The loader (as defined in the require protocol) is a
function, so the loader in your example is the function returned by
loadfile("mymod.lua"), not the file itself (though whether these two
things are distinct is a matter of point of view).