made run() generate an environment for stuff it runs

This commit is contained in:
Izaya 2017-08-27 03:52:54 +10:00
parent 1834eadb29
commit 22839cd27c

View File

@ -29,7 +29,7 @@ function loadfile(fn)
local f=io.open(fn,"rb") local f=io.open(fn,"rb")
local S=f:read("*a") local S=f:read("*a")
f:close() f:close()
return load(S) return load(S,"=("..fn..")","bt",os.genenv())
end end
function run(fn,...) function run(fn,...)
local r = {pcall(loadfile(fn),...)} local r = {pcall(loadfile(fn),...)}