diff --git a/modules/lib/sha256.lua b/modules/lib/sha256.lua index baa1e07..e145df1 100644 --- a/modules/lib/sha256.lua +++ b/modules/lib/sha256.lua @@ -6,7 +6,7 @@ -- Found Here: https://bitbucket.org/Boolsheet/bslf/src/1ee664885805/bit.lua -- -- Data card support added by https://github.com/SuPeRMiNoR2 -_G.sha = {} +sha = {} if component then if component.data and not component.ocemu then shamode = "hardware" @@ -216,3 +216,4 @@ local function datac256(data) return toHex(datac.sha256(data)) end end +return sha diff --git a/modules/lib/shutil.lua b/modules/lib/shutil.lua index f56a2a1..bdb4870 100644 --- a/modules/lib/shutil.lua +++ b/modules/lib/shutil.lua @@ -1,17 +1,18 @@ -cd=fs.cd -rm=fs.rm -mkdir=fs.mkdir -cp=fs.cp -mv=fs.mv -function ls(p) +local shutil = {} +shutil.cd=fs.cd +shutil.rm=fs.rm +shutil.mkdir=fs.mkdir +shutil.cp=fs.cp +shutil.mv=fs.mv +function shutil.ls(p) for k,v in ipairs(fs.list(p)) do print(v) end end -function cat(p) +function shutil.cat(p) local f=io.open(p) print(f:read("*a")) f:close() end -function ps(f) +function shutil.ps(f) local f=f or "" print("PID\tName") for k,v in pairs(os.tasks()) do @@ -20,13 +21,22 @@ function ps(f) end end end -function mem() +function shutil.mem() print(" \tTotal\tFree\tUsed") io.write("Mem\t") io.write(tostring(math.floor(computer.totalMemory()/1024)).."K\t") io.write(tostring(math.floor(computer.freeMemory()/1024)).."K\t") print(tostring(math.floor((computer.totalMemory()-computer.freeMemory())/1024)).."K\t") end +function shutil.genenv() + local et = os.genenv() + for k,v in pairs(shutil) do + if k ~= "genenv" then + et[k] = v + end + end + return et +end function loadfile(fn) local f=io.open(fn,"rb") local S=f:read("*a")