diff --git a/modules/lib/shutil.lua b/modules/lib/shutil.lua index 6470187..af33592 100644 --- a/modules/lib/shutil.lua +++ b/modules/lib/shutil.lua @@ -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