longlostbro

updater

Aug 7th, 2018
139
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.52 KB | None | 0 0
  1. function save(path, content)
  2.     local file = fs.open(path, "w")
  3.     file.writeLine(content)
  4.     file.close()
  5. end
  6.  
  7. file = fs.open("database/OCM2/programName", "r")
  8. local fileData = {}
  9. local line = file.readLine()
  10. repeat
  11.   table.insert(fileData, line)
  12.   line = file.readLine()
  13. until line == nil
  14. file.close()
  15. local programName = fileData[1]
  16.  
  17. shell.run("delete "..programName)
  18. print("updating...")
  19. shell.run("pastebin get uiAWwMGJ"..programName)
  20. term.clear()
  21. save("database/OCM2/state", "1")
  22. shell.run(programName)
Advertisement
Add Comment
Please, Sign In to add comment