Luart
Comprehensive Windows framework to develop in Lua
modules > ui > mousepos

ui.mousepos ( )

Get the current mouse position on the screen.

Return values

This function returns two values : the horizontal horizontal position and the vertical vertical position of the mouse.

Example


local ui = require "ui"

local ui = require "ui"

-- create a window
local win = ui.Window("Window:onClick() sample", 320, 200)
local label = ui.Label(win, "Mouse position : ", 100, 75)

win:show()

while win.visible do
	local x, y = ui.mousepos()
	label.text = "Mouse position : "..x..", "..y
	ui.update()
end