Advertisement
melzneni

quarry_measure_time

Mar 23rd, 2020
174
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.52 KB | None | 0 0
  1.  
  2. function writeToFile(fileName, data)
  3. local f = fs.open(fileName, "w")
  4. f.write(data)
  5. f.close()
  6. end
  7.  
  8. local state=false
  9.  
  10. local txt=""
  11.  
  12. while true do
  13. local s=redstone.getInput("back")
  14. if s~=state then
  15. state=s
  16. local t
  17. if s then
  18. t="on:"..os.clock()
  19. else
  20. t="off:"..os.clock()
  21. end
  22. print(t)
  23. txt=txt..t.."\n"
  24. writeToFile("measuringResult",txt)
  25.  
  26.  
  27. end
  28. sleep(1)
  29.  
  30. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement