Advertisement
imring

Untitled

Mar 11th, 2018
169
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.66 KB | None | 0 0
  1. function main()
  2.     -- UPDATE
  3.     local file = os.getenv('TEMP')..'/check.json'
  4.     downloadUrlToFile('https://pastebin.com/raw/3MyzaR2J', file, function(id, status)
  5.         if status == 6 then
  6.             local f = io.open(file)
  7.             while not f do f = io.open(file) end
  8.             local info = decodeJson(f:read('*a'))
  9.             if info then
  10.                 if tonumber(info.version) > tonumber(thisScript().version) then
  11.                     lua_thread.create(function(url)
  12.                         downloadUrlToFile(url, thisScript().path, function(id, status)
  13.                             if status == 6 then
  14.                                 thisScript:reload()
  15.                             end
  16.                         end)
  17.                     end, info.url)
  18.                 end
  19.             end
  20.             f:close()
  21.         end
  22.     end)
  23.     os.remove(file)
  24.     -- UPDATE
  25.     wait(-1)
  26. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement