Input
The Input namespace provides helpers for cursor state, key state, and cursor-based entity queries.
Functions
GetCursorPos()[number, number]
Retrieves the current cursor coordinates.
Returned:
- [number, number] - The tuple result of the call.
SetCursorPos(x: number, y: number)void
Sets the current cursor coordinates.
xnumber - The x coordinate.ynumber - The y coordinate.
IsCursorInBounds(x0: number, y0: number, x1: number, y1: number)boolean
Checks whether the cursor is within the specified bounds.
x0number - The minimum x coordinate.y0number - The minimum y coordinate.x1number - The maximum x coordinate.y1number - The maximum y coordinate.
Returned:
- boolean - True if the condition is met, false otherwise.
IsCursorInRect(x: number, y: number, width: number, height: number, align?: Enum.ContentAlign)boolean
Checks whether the cursor is within the specified rectangle.
xnumber - The x coordinate.ynumber - The y coordinate.widthnumber - The width value.heightnumber - The height value.alignEnum.ContentAlign (optional) - The content alignment value.
Returned:
- boolean - True if the condition is met, false otherwise.
IsInputCaptured()boolean
Checks whether input is currently captured by the UI.
Returned:
- boolean - True if the condition is met, false otherwise.
IsKeyDown(key: Enum.ButtonCode, checkInputCapture?: boolean)boolean
Checks whether the specified key is currently held down.
keyEnum.ButtonCode - The key value.checkInputCaptureboolean (optional) - Whether input capture should be taken into account.
Returned:
- boolean - True if the condition is met, false otherwise.
IsKeyDownOnce(key: Enum.ButtonCode, checkInputCapture?: boolean)boolean
Checks whether the specified key was pressed once.
keyEnum.ButtonCode - The key value.checkInputCaptureboolean (optional) - Whether input capture should be taken into account.
Returned:
- boolean - True if the condition is met, false otherwise.
GetNearestEntityToCursorFromList<T extends Entity>(teamType: Enum.TeamType, unitList: T[])T | null
Retrieves the closest entity to the cursor from the provided list.
teamTypeEnum.TeamType - The team filter to use.unitListT[] - The unit list to search from.
Returned:
- T | null - The matching object, or
nullif it is not available.
GetNearestHeroToCursor(teamType: Enum.TeamType)Hero | null
Retrieves the closest hero to the cursor.
teamTypeEnum.TeamType - The team filter to use.
Returned:
- Hero | null - The matching object, or
nullif it is not available.
GetNearestUnitToCursor(teamType: Enum.TeamType)NPC | null
Retrieves the closest unit to the cursor.
teamTypeEnum.TeamType - The team filter to use.
Returned:
- NPC | null - The matching object, or
nullif it is not available.
IsCursorOnMinimap()boolean
Checks whether the cursor is currently over the minimap.
Returned:
- boolean - True if the condition is met, false otherwise.
GetWorldCursorPos()Vector
Retrieves the world position under the cursor.
Returned:
- Vector - The requested world cursor pos.
GetHoveredEntityIndex()number
Retrieves the index of the entity currently hovered by the cursor.
Returned:
- number - The requested hovered entity index.
GetHoveredEntity()Entity | null
Retrieves the entity currently hovered by the cursor.
Returned:
- Entity | null - The matching object, or
nullif it is not available.