MigasRocha

Monitor Touch

Jul 13th, 2025
121
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.36 KB | Gaming | 0 0
  1. -- Wrap the monitor on top
  2. local monitor = peripheral.wrap("top")
  3.  
  4. -- Set the monitor text scale and clear it
  5. monitor.setTextScale(1)
  6. monitor.clear()
  7. monitor.setCursorPos(1,1)
  8. monitor.write("Touch the monitor...")
  9.  
  10. -- Event loop
  11. while true do
  12.     local event, side, x, y = os.pullEvent("monitor_touch")
  13.     print("Touched at X: " .. x .. ", Y: " .. y)
  14. end
  15.  
Advertisement
Add Comment
Please, Sign In to add comment