Module dotmod
Relative imports with require()
for pure Lua modules.
Info:
- Copyright: 2018
- License: MIT
- Author: un.def
Tables
package_modnames | A set of modnames that seem to be packages. |
Local Functions
get_requiring_modname () | Get the absolute name (foo.bar.baz ) of the module that is require() 'ing. |
Tables
- package_modnames
-
A set of modnames that seem to be packages.
That is, if
foo.bar
resolves tofoo/bar/init.lua
, then this table will contain["foo.bar"] = true
entry.
Local Functions
- get_requiring_modname ()
-
Get the absolute name (
foo.bar.baz
) of the module that isrequire()
'ing. The function inspects the call stack for the nearest function (chunk) with__name
local variable and returns its value.Returns:
-
absolute name on success, or
nil
and a string describing the error otherwise.