JustJurt

Install Scripts

Feb 19th, 2025 (edited)
52
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.93 KB | None | 0 0
  1. function Write_File(path, data)
  2.     fs.delete(path)
  3.  
  4.     local file = fs.open(path, "w")
  5.  
  6.     if file then
  7.         file.write(data) -- Write content to the file
  8.         file.close() -- Close the file
  9.         print("File created")
  10.     else
  11.         print("File failed to create")
  12.     end
  13. end
  14.  
  15. function Github_Download(path, githubPath)
  16.     local url = "https://raw.githubusercontent.com/Jerry-Todd/Computer-Craft-Scripts/main/"
  17.     local cacheBuster = os.epoch("utc") -- Get the current timestamp
  18.     local file = http.get(url .. githubPath .. "?t=" .. cacheBuster)
  19.     if file then
  20.         file = file.readAll()
  21.         print("Github / Got file: " .. githubPath)
  22.         Write_File(path, file)
  23.         print(" - " .. path)
  24.     else
  25.         print("Github / Cant get file: " .. githubPath)
  26.     end
  27. end
  28.  
  29. Github_Download("scripts/install/installer.lua", "scripts/install/installer.lua")
  30.  
  31. dofile("scripts/install/installer.lua")
Advertisement
Add Comment
Please, Sign In to add comment