Advertisement
JaMaNi133

install.lua

Nov 26th, 2022 (edited)
579
0
Never
1
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.16 KB | None | 0 0
  1. print("\n\nlook in local library? (y/n)")
  2. local loc =  read()
  3. print("\n\nprogram name/pasteID : ")
  4. local name = read()
  5. print("\n\nsave as ")
  6. local dest = read()
  7. print("\n\n")
  8. if loc == "y" then
  9.     lib = fs.open("OS/lib.txt", "r")
  10.     while true do
  11.         paste = lib.readLine()
  12.         if paste == nil then
  13.             error("no program found in library.")
  14.         end
  15.         filename = lib.readLine()
  16.  
  17.         if name == filename then
  18.             if dest ~= "" then
  19.                 savename = dest
  20.             else
  21.                 savename = filename
  22.             end
  23.             shell.run("pastebin","get",paste,savename)
  24.            
  25.             local reg = fs.open("OS/programs.txt","a")
  26.             reg.writeLine("")
  27.             reg.writeLine(paste)
  28.             reg.writeLine(savename)
  29.             reg.close()
  30.            
  31.             error("done")
  32.            
  33.  
  34.         end
  35.     end
  36. end
  37.  
  38. if loc == "n" then
  39.         shell.run("pastebin","get",name,dest)
  40.         local reg = fs.open("OS/programs.txt","a")
  41.         reg.writeLine("")
  42.         reg.writeLine(name)
  43.         reg.writeLine(dest)
  44.         reg.close()
  45.         error("done")
  46. end
Advertisement
Comments
Add Comment
Please, Sign In to add comment
Advertisement