I have a lua file that will require another lua file to run but I can’t hard code the file name. Can i use the require function on a variable or do i need to figure out an alternate approach to what i am doing?
For example
local path = "mypath.txt"
local level = require path
Yes, you can.
require "module"is just a syntactic sugar forrequire("module")that only works if call a function with single argument that is a string or table constructor. Use proper call in form ofrequire(path)and it will work.