Advertisement
SolidSnake96AS

SNInstaller

Oct 24th, 2014
420
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.04 KB | None | 0 0
  1. local args={...};
  2. local program;
  3.  
  4. local programs=
  5. {
  6.     {"BranchMining","yQwmA0dx","BranchMine"},
  7.     {"BranchMine Receiver", "R89UWx10", "BMReceiver"},
  8.     {"RedNet Repeater", "MyhY9QNZ", "RNRepeater"},
  9.     {"Crop Collector", "ueUCMwMT", "CC"},
  10.     {"Format", "NtZQEA1X", "format"},
  11.     {"Serpens Quarry","ed8ZAFn6","serpensQuarry"}
  12. };
  13.  
  14. term.clear()
  15. term.setCursorPos(1, 1);
  16.  
  17. print("Which program do you want to install?\n");
  18.  
  19. for i=1,#programs
  20. do
  21.     print(i.."-"..programs[i][1]);
  22. end
  23.  
  24. print("");
  25.  
  26. event,char=os.pullEvent("char");
  27.  
  28. program=tonumber(char);
  29.  
  30. if(program==nil)
  31. then
  32.     error("No program selected");
  33. end
  34.  
  35. if (program<1 or program>#programs)
  36. then
  37.     error("No program selected.");
  38. else
  39.     if (fs.exists(programs[program][3]))
  40.     then
  41.         print(programs[program][1].." already exists!\nDo you want to continue anyway? Y/N");
  42.         event,char=os.pullEvent("char");
  43.    
  44.         if(char=="y")
  45.         then
  46.             fs.delete(programs[program][3]);
  47.         else
  48.             return;
  49.         end
  50.     end
  51.    
  52.     shell.run("pastebin", "get", programs[program][2], programs[program][3]);
  53. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement