SHARE
TWEET

http.lua

a guest Jul 22nd, 2019 58 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. rednet.open('left')
  2. sleep(0.1)
  3. Program='Mine'
  4. h = http.get('turtle/'..Program..'.lua')
  5. if h then
  6.     content = h.readAll()
  7.     h.close()
  8.    
  9.     fh = io.open(Program, 'r')
  10.     fcontent = fh:read("*all")
  11.     fh:close()
  12.    
  13.     if fcontent~=content then
  14.         local fh = io.open(Program, 'w')
  15.         fh:write(content)
  16.         fh:close()
  17.    
  18.         print(Program..' updated')
  19.     else
  20.         print(Program..' not changed')
  21.     end
  22. else
  23.     print('invalid url')
  24. end
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top