DiabolusNeil

testing

Nov 14th, 2013
48
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.53 KB | None | 0 0
  1. local function get(paste)
  2.   local response = http.get(
  3.   "http://raw.github.com/DiabolusNeil/testingRepo/master/"..textutils.urlEncode(paste)
  4.   )
  5.   if response then
  6.         print("Success")
  7.         local sResponse = response.readAll()
  8.         response.close()
  9.         return sResponse
  10.   else
  11.         print("Failed")
  12.         response.close()
  13.   end
  14. end
  15.  
  16. local res = get("prog")
  17. if res then
  18.   wFile = fs.open("testing","w")
  19.   wFile.write(res)
  20.   print(res)
  21.   wFile.close()
  22.   print("Downloaded 'prog'")
  23. else
  24.   print("Error")
  25. end
Advertisement
Add Comment
Please, Sign In to add comment