Advertisement
Sanwiches

getPaste

Jan 6th, 2015
208
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.77 KB | None | 0 0
  1. --startup script keeps sHost up to date and running. Can update pastebin on user command, or restart current script
  2.  
  3. local function prompt(msg)
  4. term.clear()
  5. term.setCursorPos(1,1)
  6. term.write(msg)
  7. term.setCursorPos(1,2)
  8. local input = read()
  9. return input
  10. end
  11.  
  12. local function getPaste(saveName,paste)
  13. print("Creating file")
  14. if fs.exists(name) then --if file exists
  15. os.run("delete "..saveName)
  16. end
  17. shell.run("pastebin","get",paste,saveName)
  18. end
  19.  
  20. while true do
  21. a,b,c = nil,nil,nil
  22. local a,b,c = prompt("Commands: new progname paste, refresh progname")
  23.  
  24. if a == "new" then
  25. refreshProg = b
  26. getPaste(b,c)
  27. shell.run(refreshProg)
  28. elseif a == "refresh" then
  29. getPaste(refreshProg,c)
  30. shell.run(refreshProg)
  31. end
  32.  
  33. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement