mouse up (event)

From ComputerCraft Wiki
Jump to: navigation, search

Grid Modem.png  Event mouse_up
Fired when a mouse key (which was pressed while being inside the computer's terminal) is released. If the mouse button is released outside of the computer's display the event is fired as soon as the mouse hovers over the display again.
Returned Object 1 The mouse button that was clicked. Left Mouse Button is returned as the number 1, Right Mouse Button is returned as the number 2 and Middle Mouse Button is returned as the number 3
Returned Object 2 The X-coordinate of the release (in screen-characters).
Returned Object 3 The Y-coordinate of the release (in screen-characters).


Grid paper.png  Example
Print every button, x and y coordinates of every mouse_up event.
while true do
  local event, button, x, y = os.pullEvent( "mouse_up" )
  print( "The mouse button ", button, " was released at ", x, " and ", y )
Output The button that was released, followed by the X and Y position of where it was released.