event.scrollY

Type Number
Event mouse
Revision Release 2024.3703
Keywords mouse, scrollY

Overview

The mouse scroll’s current y scrolling value. This value depends on user mouse settings.

Example

-- Called when a mouse event has been received.
local function onMouseEvent( event )
    if event.type == "scroll" then
        if event.scrollY < 0 then
            print( "Mouse is scrolling up with a value of " .. event.scrollY .. "." )
        elseif event.scrollY > 0 then
            print( "Mouse is scrolling down with a value of " .. event.scrollY .. "." )
        end
    end
end

-- Add the mouse event listener.
Runtime:addEventListener( "mouse", onMouseEvent )