Fix undeclared global arg warning

This commit is contained in:
Lars Mueller 2021-04-22 18:13:06 +02:00
parent c13beb923b
commit 7253e2837a

@ -127,8 +127,11 @@ function loadfile_exports(filename)
return env return env
end end
local parent_dir
if not minetest then
local init_path = arg and arg[0] local init_path = arg and arg[0]
local parent_dir = init_path and init_path:match"^.[/\\]" or "" parent_dir = init_path and init_path:match"^.[/\\]" or ""
end
function load_module(module_name) function load_module(module_name)
local file = module_name .. ".lua" local file = module_name .. ".lua"
return loadfile_exports(minetest and get_resource(modlib.modname, file) or (parent_dir .. file)) return loadfile_exports(minetest and get_resource(modlib.modname, file) or (parent_dir .. file))