Advertisement
DOGGYWOOF

DOGGY OS PACKAGE INSTALLER

Jan 6th, 2024
18
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.20 KB | None | 0 0
  1. -- Function to download code from Pastebin
  2. local function downloadFromPastebin(code, programName)
  3. local url = "https://pastebin.com/raw/" .. code -- Constructing the Pastebin URL
  4. local response = http.get(url) -- Fetching the content from Pastebin
  5.  
  6. if response then
  7. local content = response.readAll() -- Reading the content of the script
  8. response.close()
  9.  
  10. -- Writing the downloaded content to a file named with the provided program name
  11. local path = "/disk/packages/" .. programName
  12. local file = fs.open(path, "w")
  13. file.write(content)
  14. file.close()
  15. print("Script downloaded as '" .. programName .. "' in '/disk/packages'")
  16. else
  17. print("Failed to download script from Pastebin. Check the code or your internet connection.")
  18. end
  19. end
  20.  
  21. -- Prompting the user to enter the Pastebin code and desired program name
  22. print("Please enter the Pastebin code of the script you want to download:")
  23. local code = read()
  24.  
  25. print("Enter the name for the program:")
  26. local programName = read()
  27.  
  28. -- Calling the function to download code from Pastebin using the entered code and program name
  29. downloadFromPastebin(code, programName)
  30.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement