Advertisement
_Jacques

exitProgram

Aug 28th, 2018
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.33 KB | None | 0 0
  1. local term = require("term")
  2. local function exitProgram() -- a function which exits the program when the letter "e" is entered.
  3. local a, b, c, d = event.pull(60, "key_down")
  4. if string.char(c) == "e" then
  5. term.clear()
  6. term.setCursor(1,1)
  7. io.write("Exitting!\n")
  8. os.sleep(1)
  9. os.exit()
  10. else
  11. os.sleep(60)
  12. end
  13. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement