ui.mousepos()

Get the current mouse position on the screen.

Return value

This function returns two numbers : the horizontal position and 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