##### Views

- Page
- Discussion
- View source
- History

# love.mouse.getX

Returns the current x-position of the mouse.

## Function

### Synopsis

x = love.mouse.getX( )

### Arguments

None.

### Returns

`number x`
  The position of the mouse along the x-axis.

## Examples

Draw a vertical line at the mouse's x-position.

function love.draw()
local x = love.mouse.getX()
love.graphics.line(x,0, x,love.graphics.getHeight())
end

## See Also

- love.mouse
- love.mouse.getY
- love.mouse.getPosition

## Other Languages

Dansk – Deutsch – English – Español – Français – Indonesia – Italiano – Lietuviškai – Magyar – Nederlands – Polski – Português – Română – Slovenský – Suomi – Svenska – Türkçe – Česky – Ελληνικά – Български – Русский – Српски – Українська – עברית – ไทย – 日本語 – 正體中文 – 简体中文 – Tiếng Việt – 한국어
More info

Retrieved from "https://www.love2d.org/wiki/love.mouse.getX"
Categories: Templates | Functions

##### Personal tools

- Log in

##### Search

##### Toolbox

- What links here
- Related changes
- Special pages
- Printable version
- Permanent link
- Browse properties