Skip to content

Commit 54a1e8d

Browse files
committed
move script_environment changes to test.lua
1 parent e4cab1b commit 54a1e8d

2 files changed

Lines changed: 14 additions & 6 deletions

File tree

ci/test.lua

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,17 @@ end
8888
local test_scripts = {is_test_scripts=true}
8989
local test_envvars = {}
9090
local function clean_reqscript(name)
91-
return dfhack.script_environment(name, true, test_envvars, test_scripts)
91+
local path = dfhack.findScript(name)
92+
if test_scripts[path] then return test_scripts[path].env end
93+
local _, env = dfhack.run_script_with_env(
94+
test_envvars,
95+
name,
96+
{
97+
scripts=test_scripts,
98+
module=true,
99+
module_strict=true
100+
})
101+
return env
92102
end
93103
test_envvars.require = clean_require
94104
test_envvars.reqscript = clean_reqscript

library/lua/dfhack.lua

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -602,15 +602,13 @@ function dfhack.reqscript(name)
602602
end
603603
reqscript = dfhack.reqscript
604604

605-
function dfhack.script_environment(name, strict, envVars, scripts)
606-
scripts = scripts or internal.scripts
605+
function dfhack.script_environment(name, strict)
606+
local scripts = internal.scripts
607607
local path = dfhack.findScript(name)
608608
if not scripts[path] or scripts[path]:needs_update() then
609-
local _, env = dfhack.run_script_with_env(
610-
envVars,
609+
local _, env = dfhack.run_script_with_env(nil,
611610
name,
612611
{
613-
scripts=scripts,
614612
module=true,
615613
module_strict=(strict and true or false) -- ensure that this key is present if 'strict' is nil
616614
})

0 commit comments

Comments
 (0)