Advertisement
Neon1432

newsetup

May 3rd, 2022 (edited)
889
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.55 KB | None | 0 0
  1. local args = {...}
  2.  
  3. local httpResponse = http.get('http://localhost:8080/')
  4. if httpResponse == nil then printError('visit https://tweaked.cc/guide/local_ips.html') return end
  5. local names = textutils.unserialise(httpResponse.readAll())
  6.  
  7.  
  8. for I = 1, table.getn(names) do
  9.     if fs.exists(names[I]) then
  10.         fs.delete(names[I])
  11.     end
  12.     local afile = fs.open(names[I], "w")
  13.     local response = http.get('http://localhost:8080/test?name='..names[I])
  14.     afile.write(response.readAll())
  15.     afile.close()
  16. end
  17. print('Successfully loaded '..table.getn(names)..' files')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement