Advertisement
dannysmc95

Discover App Installer

Aug 9th, 2016
1,435
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.95 KB | None | 0 0
  1. --[[
  2.     Name: Discover App Installer
  3.     Author: DannySMc (dannysmc95)
  4. ]]
  5.  
  6. --// Define Functions
  7. function clear()
  8.     term.clear();
  9.     term.setCursorPos(1,1);
  10. end
  11.  
  12. function setColour(tc, bc)
  13.     term.setTextColor(colours[tc]);
  14.     term.setBackgroundColour(colours[bc]);
  15. end
  16.  
  17. --// Start Code
  18. clear(); setColour('cyan', 'black');
  19. print("DiscoverApp Installer");
  20. setColour("orange", "black");
  21. print("Please choose the path to install the file to:");
  22. setColour("red", "black");
  23. write("> ");
  24. setColour("white", "black");
  25. local path = tostring(read());
  26. setColour("orange", "black");
  27. print("Checking, please wait...");
  28. if fs.exists(path) then
  29.     error("File already exists in that path...");
  30. end
  31. print("Installing, please wait...");
  32.  
  33. local url = 'http://discoverapi.xyz/files/download/discoverapp/lua';
  34. local d = http.get(url)
  35. local data = d.readAll()
  36. local f = fs.open(path, "w")
  37. f.write(data)
  38. f.close();
  39.  
  40. print("Success!! Discover is installed as: " .. path);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement