after loading a module in Lua, I’d like to determine what module file this corresponds to. In python, you do this with code like:
import module_name
module_name.__file__
So in Lua if I do something like
require 'math'
what do I put next to determine where this module is located? Btw, I don’t actually need the location of math, but instead have some other third-party packages that were downloaded and want to know what copy of the build files are actually being used when I invoke Lua.
The
packagelibrary might give you what you need.For instance, if I have
util.luain my Lua path such that I can write:I can get the path to the file like this: