Margresse404

timerAndTouch

Jun 23rd, 2018
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.53 KB | None | 0 0
  1. --Other events
  2. function processEvents(event)
  3. if event[1] == "monitor_touch" then
  4. local xPos = event[3]
  5. local yPos = event[4]
  6. -- Check if it in a certain range and handle
  7. processTouchEvents(xPos, yPos)
  8. end
  9. end
  10.  
  11. local function wait (time)
  12. local timer = os.startTimer(time)
  13. while true do
  14. local event = {os.pullEvent()}
  15. if (event[1] == "timer" and event[2] == timer) then
  16. break
  17. else
  18. processEvents(event) -- a custom function in which you would deal with received events
  19. end
  20. end
  21. end
Advertisement
Add Comment
Please, Sign In to add comment