Advertisement
BlueMond

Update

Jan 3rd, 2014
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.78 KB | None | 0 0
  1. local version = "1.50"  --change this to allow for an update (4 chars only)
  2. local filename = "update"  --change this to the name of the file holding this program
  3. local paste = "TKDQVfbj"  --change this to the pastebin entry code
  4.  
  5. local function update()
  6.         local url = "http://pastebin.com/raw/"..paste
  7.         local temp = http.get(url)
  8.         local ver = string.sub(temp.readLine(), 18, 21)
  9.         print(version..":"..ver)
  10.         if ver ~= version then
  11.                 fs.delete(filename)
  12.                 shell.run("pastebin get "..paste.." "..filename)
  13.                 shell.run(filename)
  14.                 return true
  15.         end
  16.         return false
  17. end
  18.  
  19. --end instance of previous version if updated
  20. if update() then
  21.     error()
  22. end
  23.  
  24. --program code can go down here
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement