Advertisement
KedrikFeeD

test-parallel.lua

Feb 8th, 2025 (edited)
42
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.63 KB | None | 0 0
  1. EButtons = { Left = 1, Right = 2, Middle = 3 }
  2.  
  3. local function leftClickHandler()
  4.     while true do
  5.         local _, button, x, y = os.pullEvent("mouse_click")
  6.         if (button == EButtons.Left) then
  7.             print(("Left button was pressed at %d, %d"):format(button, x, y))
  8.         end
  9.     end
  10. end
  11.  
  12. local function rightClickHandler()
  13.     while true do
  14.         local _, button, x, y = os.pullEvent("mouse_click")
  15.         if (button == EButtons.Right) then
  16.             print(("Right button was pressed at %d, %d"):format(button, x, y))
  17.         end
  18.     end
  19. end
  20.  
  21. parallel.waitForAll(leftClickHandler, rightClickHandler)
  22.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement