mouse_click - bradyakent/CC-Tweaked GitHub Wiki
This event is fired when the terminal is clicked with a mouse.
Return values
string
: The event name.number
: 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. If you have more than three buttons on your mouse, pressing them will return 1.number
: The X-coordinate of the click (in screen-characters).number
: The Y-coordinate of the click (in screen-characters).
Other notes
- This event is only available on Advanced systems, as only Advanced systems have mouse support.
Example
Print the button and the coordinates of every mouse click:
while true do
local event, button, x, y = os.pullEvent( "mouse_click" )
print( "The mouse button ", button, " was pressed at ", x, " and ", y )
end