luamultilinguallua-apicross-language

require()ing a dll within a subdirectory in Lua


Lua's require(<name>) function, if called on a <name>.dll, will look for a function called luaopen_<name>.

What should I do if I want to say require("folder1.folder2.library")? It's not like I can name a function luaopen_folder1.folder2.library.

I am looking for a way to do this that doesn't involve changing Lua's module path—i.e. a way to do this that scales with the complexity of a project.


Solution

  • Name the function luaopen_folder1_folder2_library.