lua-users home
lua-l archive

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


2015-09-23 13:58 GMT+01:00 Dirk Laurie <dirk.laurie@gmail.com>:
> In a program, one can say
>
> mymod = require "mymod"
>
> or
>
> mymod = dofile "mymod.lua"
>
> Is there any way that the code of "mymod.lua" can distinguish
> between these?

Yes:
  - require will pass the module name to the file chunk as argument
  - dofile doesn't pass any argument