The easiest way to execute a Lua script from another script is to use dofilethat translates the file path:
dofile"myconfig.lua"
dofile "/usr/share/myapp/config.lua"
dofile , script. , , , pcall:
local ok,e = pcall(dofile,"myconfig.lua")
if not ok then
-- handle error; e has the error message
end
, loadfile, :
local f,e = loadfile("myconfig.lua")
if f==nil then
end
local ok,e = pcall(f)
if not ok then
end