GetUIObjectAtPosition(integer, table)
Description
Section titled “Description”The GetUIObjectAtPosition Lua function returns the handle of the UI Object at a specified position on a specified display.
Argument
Section titled “Argument”-
Integer:
The integer should be the index number of the display with the UI object. -
Table:
The table must have two elements with the following keys:- x: This is the X position on the display. The value must be a number indicating the desired pixel position. It is counted from the left side of the display.
- y: This is the Y position on the display. The value must be a number indicating the desired pixel position. It is counted from the top of the display.
Return
Section titled “Return”- Handle | nil:
If a UI object is at the provided position, then the handle to the object is returned. Otherwise, it returns nil.
Example
Section titled “Example”This example prints the Dump of the UIObject at a specific position on display 1. It also uses the DrawPointer function to draw a red pointer at the position.
Dump()
Section titled “Dump()”The Dump() function returns a string with information about the object, for instance, the name, class, path of the object, its properties, and children.
Learn more in the Dump() topic.
The DrawPointer function draws a red pointer at a display. Learn more about it in the DrawPointer() topic.
| Copy CodeLua |
| ``` |
| return function() |
-- Get the index number for "Display 1"local displayIndex = GetDisplayCollect()["Display 1"].INDEX-- Create a table with X and Y positionlocal positionTable = {}positionTable.x = 1000positionTable.y = 500-- Get the UI object handlelocal uiObjectAtPositionHandle = GetUIObjectAtPosition(displayIndex,positionTable)-- Dump all information about the display with the index number if not nilif uiObjectAtPositionHandle == nil then Printf("The returned value was not a valid handle.") returnend-- Draw a pointer at the posiiton for 5 secondsDrawPointer(displayIndex,positionTable,5000)--Dump of the UIObjectPrintf("=============== START OF DUMP ===============")uiObjectAtPositionHandle:Dump()Printf("================ END OF DUMP ================")end