🎮Input

Table to work with input system.

GetWorldCursorPos(): Vector

Returns world cursor position.


GetCursorPos(): number, number

Returns screen cursor position (x, y). See example.

Example

local x, y =	Input.GetCursorPos()

IsCursorInRect(x: number, y: number, w: number, h: number): boolean

Name
Type
Description

x

number

x position

y

number

w

number

width

h

number

height

Returns true if cursor is in rect.


IsCursorInBounds(x0: number, y0: number, x1: number, y1: number): boolean

Name
Type
Description

x0

number

y0

number

x1

number

y1

number

Returns true if cursor is in bounds.


GetNearestUnitToCursor(teamNum: Enum.TeamNum, teamType: Enum.TeamType): CNPC|nil

Excludes not visible, illusions and dead units.

Name
Type
Description

teamNum

team number. Could be get from Entity.GetTeamNum

teamType

team type to search relative to teamNum param

Returns nearest unit to cursor.


GetNearestHeroToCursor(teamNum: Enum.TeamNum, teamType: Enum.TeamType): CHero|nil

Excludes not visible, illusions and dead heroes.

Name
Type
Description

teamNum

team number. Could be get from Entity.GetTeamNum

teamType

team type to search relative to teamNum param

Returns nearest hero to cursor.


IsInputCaptured(): boolean

Returns true if input is captured. e.g. opened console, chat, shop.


IsKeyDown(KeyCode: Enum.ButtonCode): boolean

Name
Type
Description

Returns true if key is down.


IsKeyDownOnce(KeyCode: Enum.ButtonCode): boolean

This function will return `true` only once per key press.

Name
Type
Description

Return true if key is down once.

Last updated