Advertisement
sammie287

HardDiskSpace.lua

Aug 16th, 2017
52
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.41 KB | None | 0 0
  1. local component = require("component")
  2. fs = component.filesystem
  3. usedSpace = fs.spaceUsed()
  4. totalSpace = fs.spaceTotal()
  5. percentUsed = (usedSpace/totalSpace)*100
  6.  
  7. function round (num, numDecimalPlaces)
  8.   local mult = 10^(numDecimalPlaces or 0)
  9.   return math.floor(num * mult + 0.5) / mult
  10. end
  11.  
  12.  
  13.  
  14. print(usedSpace .. " bytes of your harddrive are being used, it is " .. round(percentUsed, 2) .. "% full.")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement