Rolcam

ComputerCraft Computer Formatter

May 10th, 2020 (edited)
211
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.61 KB | None | 0 0
  1. while true do
  2. term.clear()
  3. term.setCursorPos(1,1)
  4. print("WARNING: You are attempting to format this computer! This process is irreverible!")
  5. print("Do you wish to continue? Yes/No")
  6. local input = read()
  7.  
  8. if input == "Yes" or input == "yes" or input == "YES" then
  9. shell.run("label","clear")
  10. for _,file in ipairs(fs.list("/")) do
  11.   if not fs.isReadOnly(file) then
  12.     fs.delete(file)
  13.   end
  14. end
  15. print("Format Complete")
  16.   sleep(2)
  17.   os.reboot()
  18. elseif input == "No" or input == "no" or input == "NO" then
  19.     print("Terminating Program")
  20.     break
  21. else
  22.     print("Invalid Input! Try again")
  23.     sleep(3)
  24. end
  25. end
Add Comment
Please, Sign In to add comment