Advertisement
Guest User

ComputerCraft / Wait for disk

a guest
Feb 12th, 2018
163
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.56 KB | None | 0 0
  1. while true do
  2.     -- Wait for disk
  3.     while not fs.exists("/disk/startup") do
  4.         os.pullEvent("disk")
  5.         -- might cause problems, maybe use os.pullEvent() without arguments
  6.     end
  7.  
  8.     -- Launch disk
  9.     shell.run("/disk/startup")
  10.  
  11.     -- Wait for disk ejection and clear
  12.     while fs.exists("/disk/startup") do
  13.         os.pullEvent("disk_eject")
  14.         -- might cause problems, maybe use os.pullEvent() without arguments
  15.         term.clear()
  16.         term.setCursorPos(1, 1)
  17.         -- os.reboot() works too to clear the screen
  18.     end
  19. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement