Advertisement
guitarplayer616

Media Player

Dec 26th, 2015
181
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.63 KB | None | 0 0
  1. term.clear()
  2. term.setCursorPos(1,1)
  3. print("Media Player 9000")
  4.  
  5. function play()
  6.   pause = true
  7.   print()
  8.   print("Press Space to Play/Pause")
  9.   print("Press Tab to Eject")
  10.   while true do
  11.     local e,k = os.pullEvent("key")
  12.     if k == keys.space then
  13.       if pause then
  14.         disk.playAudio("left")
  15.         pause = false
  16.       else
  17.         disk.stopAudio("left")
  18.         pause = true
  19.       end
  20.     elseif k == keys.tab then
  21.       disk.eject("left")
  22.     end
  23.   end
  24. end
  25.      
  26.          
  27.  
  28. if disk.hasAudio("left") then
  29.   print("  "..disk.getAudioTitle("left"))
  30.   play()
  31. else
  32.   print("Please insert disc")
  33. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement