Advertisement
Guest User

321

a guest
Nov 24th, 2014
144
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.67 KB | None | 0 0
  1. --tapep, rewinds and plays the tape, pauses playing drives. Use tapep -p to play the tape without rewinding it before
  2. --Author: Bizzycola and Vexatos
  3.  
  4. local component = require("component")
  5. local shell = require("shell")
  6. local args, options = shell.parse(...)
  7.  
  8. if not component.isAvailable("tape_drive") then
  9. io.stderr:write("This program requires a tape drive to run.")
  10. return
  11. end
  12.  
  13. local tape = component.tape_drive
  14.  
  15. if not tape.isReady() then
  16. io.stderr:write("The tape drive does not contain a tape.")
  17. return
  18. end
  19.  
  20. if tape.getState() == "PLAYING" then
  21. tape.stop()
  22. else
  23. if not options.p then
  24. tape.seek(-tape.getSize())
  25. end
  26. tape.play()
  27. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement