diff --git a/ci/test.lua b/ci/test.lua index 0fb6ac49c..bdd7be8d8 100644 --- a/ci/test.lua +++ b/ci/test.lua @@ -88,7 +88,17 @@ end local test_scripts = {is_test_scripts=true} local test_envvars = {} local function clean_reqscript(name) - return dfhack.script_environment(name, true, test_envvars, test_scripts) + local path = dfhack.findScript(name) + if test_scripts[path] then return test_scripts[path].env end + local _, env = dfhack.run_script_with_env( + test_envvars, + name, + { + scripts=test_scripts, + module=true, + module_strict=true + }) + return env end test_envvars.require = clean_require test_envvars.reqscript = clean_reqscript diff --git a/library/lua/dfhack.lua b/library/lua/dfhack.lua index f3956d174..b19dd3877 100644 --- a/library/lua/dfhack.lua +++ b/library/lua/dfhack.lua @@ -602,15 +602,13 @@ function dfhack.reqscript(name) end reqscript = dfhack.reqscript -function dfhack.script_environment(name, strict, envVars, scripts) - scripts = scripts or internal.scripts +function dfhack.script_environment(name, strict) + local scripts = internal.scripts local path = dfhack.findScript(name) if not scripts[path] or scripts[path]:needs_update() then - local _, env = dfhack.run_script_with_env( - envVars, + local _, env = dfhack.run_script_with_env(nil, name, { - scripts=scripts, module=true, module_strict=(strict and true or false) -- ensure that this key is present if 'strict' is nil })