As the title says... Chat on...

User avatar
By curt
#54091 I would appreciate it if someone would provide a clue or pointer as to how to include a module with a Lua program. Say, there is a require("some_module") statement in my Lua program, does one simply load the module file, i.e., some_module.lua, along with the application program that contains the require() statement ? If not how ? I am using Lua Loader and have tried loading the module along with the application program and it doesn't seem to work.
Thanks,Curt
User avatar
By marcelstoer
#54107 The argument that `require("some_module")` takes is a reference to a module name. Modules are often initialize like this

Code: Select alllocal modname = ...
local M = {}
_G[modname] = M


That makes the module name be just like the file name w/o `.lua`. Hence, in reality it's usually `require("module-file-name-without-dot-lua")`. Just place the module file alongside init.lua in the file system and it'll be picked up.