Difference between revisions of "Mouse click (event)"
From ComputerCraft Wiki
(fixed again) |
(event specs) |
||
| Line 2: | Line 2: | ||
|name=mouse_click | |name=mouse_click | ||
|desc=Fired when the terminal is clicked. | |desc=Fired when the terminal is clicked. | ||
| − | |return1 | + | |return1=The mouse button that was clicked. |
| − | + | |return2=The X-coordinate of the click (in screen-characters). | |
| − | | | + | |return3=The Y-coordinate of the click (in screen-characters). |
| − | | | + | |
|examples= | |examples= | ||
{{Example | {{Example | ||
Revision as of 09:23, 7 December 2012
Examples
| Print the button and the co-ordinates of every mouse click we receive a mouse_click event. | |
| Code |
while true do
event, button, xPos, yPos = os.pullEvent("mouse_click")
print(event .. " => " .. tostring(button) .. ": " .. tostring(button) .. ", " ..
"X: " .. tostring(xPos) .. ", " ..
"Y: " .. tostring(yPos))
end
|
| Output | The button that was pressed, followed by the X and Y position of the event. |