BrunoZockt

OCM-Beta.updater

Sep 15th, 2018
315
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.61 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. function Splitter(inputstr, sep)
  8. if sep == nil then
  9. sep = "%s"
  10. end
  11. local t, i = {}, 1
  12. for str in string.gmatch(inputstr, "([^"..sep.."]+)") do
  13. t[i] = str
  14. i = i + 1
  15. end
  16. return t
  17. end
  18.  
  19. local programName = Splitter(shell.getRunningProgram(), "/")[2]
  20. print(programName)
  21. os.pullEvent("key")
  22.  
  23. shell.run("delete "..programName)
  24. print("updating...")
  25. shell.run("pastebin get fptxKN9n "..programName)
  26. term.clear()
  27. save("database/"..programName.."/state", "1")
  28. shell.run(programName)
Add Comment
Please, Sign In to add comment