Skip to main content

Common

Common library with some useful helper functions and classes made by our Lua developers.

Functions

DelayAction

Common.DelayAction( action: function, delay: number ) void

ArgumentTypeDescription
actionfunctionGiven action function
delaynumberGiven delay

Executes given action (function) after given delay (in seconds) using OnTick.


DelayActionPrecise

Common.DelayActionPrecise( action: function, delay: number ) void

ArgumentTypeDescription
actionfunctionGiven action function
delaynumberGiven delay

Executes given action (function) after given delay (in seconds) using OnDraw.


DelayActionFrames

Common.DelayActionFrames( action: function, frames: number ) void

ArgumentTypeDescription
actionfunctionGiven action function
framesnumberGiven frames to wait

Executes given action (function) after certain given frames.


Queue

Common.Queue() Queue

Creates and returns empty Queue instance.


Queue

Common.Queue( t: any[] ) Queue

ArgumentTypeDescription
tany[]Table with elements

Creates and returns Queue instance based on table with elements with index starting from 1.


GetEnumName

Common.GetEnumName( enumTable: any[], enum: any ) string

ArgumentTypeDescription
enumTableany[]Enumeration table
enumanyEnumeration value

Returns enum name.


RollChance

Common.RollChance( chance: number ) boolean

ArgumentTypeDescription
chancenumberAny number in range from 0 to 100

Rolls a chance. Returns true if roll is successful.


GetRemainingRecallTime

Common.GetRemainingRecallTime() number

Returns remaining recall time for player.


IsUnitImmune

Common.IsUnitImmune(
unit: AIBaseClient
) boolean

ArgumentTypeDescription
unitAIBaseClientUnit to check

Returns whether unit has immunity.


IsUnitSpellImmune

Common.IsUnitSpellImmune(
unit: AIBaseClient
) boolean

ArgumentTypeDescription
unitAIBaseClientUnit to check

Returns whether unit has spell immunity (i.e. has spellshield).


IsFleeing

Common.IsFleeing(
unit: AIBaseClient,
pos: Vector3
) boolean

ArgumentTypeDescription
unitAIBaseClientUnit to check
posVector3Position to check

Returns whether unit is fleeing from gives position.


ClosestEnemy

Common.ClosestEnemy() AIHeroClient

Returns closest enemy to the player.