craniumkid22

Update Function

Apr 27th, 2013
124
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.38 KB | None | 0 0
  1. local function update(path, code)
  2.     local site = http.get("http://pastebin.com/raw.php?i="..code)
  3.     local siteInfo = site.readAll()
  4.     site.close()
  5.     local file = fs.open(path, "r")
  6.     local fileInfo = file.readAll()
  7.     file.close()
  8.     if siteInfo ~= fileInfo then
  9.         local fileWrite = fs.open(path, "w")
  10.         fileWrite.write(siteInfo)
  11.         fileWrite.close()
  12.         return true
  13.     end
  14.     return false
  15. end
Advertisement
Add Comment
Please, Sign In to add comment