Function
love.mouse.getX( )
Gets the current x-position of the mouse. Use this if you for some reason only need the position along the x-axis. Otherwise, you probably want to use love.mouse.getPosition.
Synopsis
x = love.mouse.getX( )
Arguments
(None)
Returns
number Current x-position.
Examples
Example 3: Getting the x- and y-position of the mouse
function load()
    local f = love.graphics.newFont(love.default_font, 14)
    love.graphics.setFont(f)
end

function draw()
    -- Gets the x- and y-position of the mouse.

    local x = love.mouse.getX()
    local y = love.mouse.getY()
    -- Draws the position on screen.

    love.graphics.draw("The mouse is at (" .. x .. "," .. y .. ")", 50, 50)
end
Copyright © 2006-2008 LÖVE Development Team.