Advertisement
MageCoven

install.lua

Jul 17th, 2025
218
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.90 KB | None | 0 0
  1. local URL = "https://raw.githubusercontent.com/MageCoven/fishnet/refs/heads/main/src/"
  2.  
  3. local files = {
  4.     "lib/fishnet.lua",
  5.     "lib/persistent_queue.lua",
  6.     "lib/persistent_task.lua",
  7.     "receive.lua",
  8.     "startup.lua",
  9.     "worker.lua"
  10. }
  11.  
  12. local function downloadFile(path, dest)
  13.     local url = URL .. path
  14.     local response = http.get(url)
  15.     if not response then
  16.         error("Failed to download " .. url)
  17.     end
  18.     local content = response.readAll()
  19.     response.close()
  20.  
  21.     local file = fs.open(dest, "w")
  22.     if not file then
  23.         error("Could not open file for writing: " .. dest)
  24.     end
  25.  
  26.     file.write(content)
  27.     file.close()
  28. end
  29.  
  30. for _, file in ipairs(files) do
  31.     if not fs.exists(file) then
  32.         print("Downloading " .. file .. "...")
  33.         downloadFile(file, file)
  34.     else
  35.         print(file .. " already exists, skipping download.")
  36.     end
  37. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement