Advertisement
asteroidsteam

onlineInstruct

Apr 1st, 2018
293
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.56 KB | None | 0 0
  1. local links = {
  2. }
  3. function explode(div,str)
  4.   if (div=='') then return false end
  5.   local pos,arr = 0,{}
  6.   for st,sp in function() return string.find(str,div,pos,true) end do
  7.     table.insert(arr,string.sub(str,pos,st-1))
  8.     pos = sp + 1
  9.   end
  10.   table.insert(arr,string.sub(str,pos))
  11.   return arr
  12. end
  13. for i=1,#links do
  14.   local a = explode(",",links[i])
  15.   if http.checkURL(a[1]) then
  16.     local files = http.get(a[1])
  17.     local code = files.readAll()
  18.     files.close()
  19.     local file = fs.open(a[2],"w")
  20.     file.write(code)
  21.     file.close()
  22.   end
  23. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement