[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: Dirk Laurie <dirk.laurie@...>
- Date: Wed, 23 Sep 2015 16:15:15 +0200
2015-09-23 16:04 GMT+02:00 Luiz Henrique de Figueiredo <lhf@tecgraf.puc-rio.br>:
>> - require will pass the module name to the file chunk as argument
>
> Since Lua 5.2, require also passes the path to the file:
>
> % cat m.lua
> print("args",...)
>
> % lua -lm /dev/null
> args m ./m.lua
>
> % lua m.lua
> args
In other words, there is stuff in `...` in the case of require,
nothing otherwise. Thanks, I was using "arg" and figured
out that it does not deliver.
I have never understood what the manual means by "loader".
Is "mymod.lua" a loader for the module "mymod"?