-- ============================== -- Auto-update -- Downloading and replace running file -- ============================== K_VERSION = 1.000 -- Version of program. Need for auto-update local source = "http://pastebin.com/raw.php?i=dsQ8c2UR" -- Source code of programm local function autoUpdate() -- Get version of last if not http then return end local httpResponce = http.get(source) local allText = httpResponce.readAll() httpResponce.close() local newVersion = 0 local _,verPos = string.find(allText, 'K_VERSION *= *') if verPos then newVersion = tonumber(string.match(allText, '%d+[%.?%d*]*', verPos+1)) end -- Compare and replace if K_VERSION < newVersion then local sFile = shell.getRunningProgram() local f = fs.open(sFile, "w") f.write(allText) f.close() os.reboot() end end autoUpdate()