Advertisement
koki2000

update system

Oct 5th, 2015
140
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.12 KB | None | 0 0
  1. -- v 1.02
  2.  
  3. local ujverzio
  4. local regiverzio
  5.  
  6. function clear()
  7. term.clear()
  8. term.setCursorPos(1,1)
  9. end
  10.  
  11. local function updateStartup()
  12. clear()
  13.         shell.run("pastebin","get","46fcnT3t","update")
  14.  
  15.         local file = fs.open("update", "r")
  16.         lx = file.readLine()
  17.         s1 = lx:find("v")
  18.         ujverzio = tonumber(lx:sub(s1+2))
  19.         file.close()
  20.         clear()
  21.         print("Uj verzio: ", ujverzio)
  22.         sleep(1)
  23.        
  24.         local file = fs.open("startup", "r")
  25.         lx = file.readLine()
  26.         s1 = lx:find("v")
  27.         regiverzio = tonumber(lx:sub(s1+2))
  28.         file.close()
  29.         print("regi verzio: ", regiverzio)
  30.         sleep(1)
  31.        
  32.         if regiverzio < ujverzio or regiverzio > ujverzio then
  33.                 fs.delete("startup")
  34.                 fs.copy("update", "startup")
  35.                 fs.delete("update")
  36.                 shell.run("startup")
  37.         else
  38.                 fs.delete("update")
  39.                 clear()
  40.                 print("nincs elerheto frissites")
  41.                 sleep(1)
  42.                 return false
  43.         end
  44. end
  45.  
  46. updateStartup()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement