Difference between revisions of "Mouse scroll (event)"
From ComputerCraft Wiki
TheCoryKid (Talk | contribs) m (Removed the NeedsWork and fixed my own error.) |
TheCoryKid (Talk | contribs) m (*cough* Apparently, the Event template doesn't allow for more than three return values?) |
||
| Line 2: | Line 2: | ||
|name=mouse_scroll | |name=mouse_scroll | ||
|desc=Fired when a mousewheel is scrolled in the terminal | |desc=Fired when a mousewheel is scrolled in the terminal | ||
| − | |return1 | + | |return1=The direction of the mouse-scroll (<var>-1</var> = up, <var>1</var> = down). |
| − | + | |return2=The X-coordinate of the scroll (in screen-characters). | |
| − | | | + | |return3=The Y-coordinate of the scroll (in screen-characters). |
| − | | | + | |
|examples= | |examples= | ||
{{Example | {{Example | ||
Revision as of 08:31, 4 May 2013
Examples
| Print the direction and the co-ordinates of every mouse scroll we receive a mouse_scroll event for. | |
| Code |
while true do
_, dir, x, y = os.pullEvent("mouse_scroll")
print("mouse_scroll: " .. tostring(dir) .. ", " ..
"X: " .. tostring(x) .. ", " ..
"Y: " .. tostring(y))
end
|
| Output | The direction the mouse-wheel was scrolled in, followed by the X and Y position of the event. |