GetCursorPosition
Where the player’s cursor points, in the UI space.
The pointer’s place in the UI space (GetScreenSize: 1080 rows high, the width following the screen’s shape) while
the cursor is up, the place OnMouseMove last told; nil while the cursor is down. For a hover check in
OnFrame without keeping the place yourself.
Syntax
Section titled “Syntax”GetCursorPosition()Returns
Section titled “Returns”number|nil, number|nil - x, y - the place in the UI space, or nil while the cursor is down
Example
Section titled “Example”function OnFrame(dt) local x, y = GetCursorPosition() if x then SetUiPos("tooltip", x + 16, y + 16) endendSee also
Section titled “See also”OnMouseMove · IsCursorShown · the The game’s UI for a script group of the index
