added loadfile, run and srun to shutil.

This commit is contained in:
Izaya 2017-08-04 07:08:44 +10:00
parent b1e40cbdb3
commit d68f8f9edd
1 changed files with 12 additions and 0 deletions

View File

@ -24,3 +24,15 @@ function mem()
io.write(tostring(math.floor(computer.freeMemory()/1024)).."K\t")
print(tostring(math.floor((computer.totalMemory()-computer.freeMemory())/1024)).."K\t")
end
function loadfile(fn)
local f=io.open(fn,"rb")
local S=f:read("*a")
f:close()
return load(S)
end
function run(fn,...)
print(pcall(loadfile(fn),...))
end
function srun(fn,...)
spawn(fn,print(pcall(loadfile(fn),...)))
end