Advertisement
CelticCoder

ubertemp

Jan 24th, 2024 (edited)
9
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.85 KB | None | 0 0
  1. function import(ID, name)
  2.     local pastebinID = ID
  3.     local scriptFileName = name .. ".lua"  -- Change this to the desired filename
  4.  
  5.     -- Download the script from Pastebin
  6.     local response = http.get("https://pastebin.com/raw/" .. pastebinID)
  7.  
  8.     -- Check if the download was successful
  9.     if response then
  10.         -- Read the contents of the script
  11.         local scriptContent = response.readAll()
  12.         response.close()
  13.  
  14.         -- Open a file on the turtle's file system and write the script content to it
  15.         local file = fs.open(scriptFileName, "w")
  16.         file.write(scriptContent)
  17.         file.close()
  18.  
  19.         print("Script downloaded and saved as " .. scriptFileName)
  20.     else
  21.         print("Failed to download script from Pastebin")
  22.     end
  23. end
  24.  
  25. fs.delete("temp.lua")
  26. import("NXanBmQA", "temp")
  27. os.loadAPI("temp.lua")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement