DrFair

SE Fast Build

Jun 13th, 2014
296
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.83 KB | None | 0 0
  1. fileName = "text"
  2.  
  3. function getData()
  4. local path = shell.resolve( fileName )
  5. if fs.exists( fileName ) then
  6. local file = fs.open( path, "r" )
  7. data = file.readAll()
  8. end
  9. end
  10.  
  11. function printData()
  12. local path = shell.resolve( fileName )
  13. if fs.exists( fileName ) then
  14. fs.delete( fileName )
  15. end
  16. local file = fs.open( path, "w" )
  17. file.write( data )
  18. file.close()
  19. end
  20.  
  21. getData()
  22. stringEnd = 0
  23.  
  24. while true do
  25. stringStart = string.find( "<BuildTimeSeconds>", stringEnd )
  26. stringEnd = string.find( "<", stringStart )
  27. number = tonumber(string.sub( data, stringStart + 18, stringEnd - 1 ))
  28. if number == 0 then
  29. print( "Job done. Printing text to file: "..fileName )
  30. printData()
  31. break
  32. else
  33. data = string.sub( data, 0, stringStart + 18 )..(number*0.2)..string.sub( data, stringEnd - 1, #data )
  34. end
  35. end
Advertisement
Add Comment
Please, Sign In to add comment