event.scrollX

Type Number
Event mouse
Revision Current Public Release (2018.3326)
Keywords mouse, scrollX

Overview

The mouse scroll's current x 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.scrollX < 0 then
            print( "Mouse is scrolling left with a value of " .. event.scrollX .. "." )
        elseif event.scrollX > 0 then
            print( "Mouse is scrolling right with a value of " .. event.scrollX .. "." )
        end
    end
end

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