Skip to content

Commit

Permalink
Add devel/clear-script-env
Browse files Browse the repository at this point in the history
  • Loading branch information
lethosor committed Nov 7, 2015
1 parent 52989ab commit d276d4d
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions scripts/devel/clear-script-env.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
-- Clear script environment
--[[=begin
devel/clear-script-env
======================
Clears the environment of the specified lua script(s).
=end]]
args = {...}
if #args < 1 then qerror("script name(s) required") end
for _, name in pairs(args) do
local file = dfhack.findScript(name)
if file then
local script = dfhack.internal.scripts[file]
if script then
local env = script.env
while next(env) do
env[next(env)] = nil
end
else
dfhack.printerr("Script not loaded: " .. name)
end
else
dfhack.printerr("Can't find script: " .. name)
end
end

0 comments on commit d276d4d

Please sign in to comment.