Isaac API Class
Functions
getIsaacAPIClassName
▸ getIsaacAPIClassName(object
): string
| undefined
Helper function to get the name of a class from the Isaac API. This is contained within the "__type" metatable key.
For example, a Vector
class is has a name of "Vector".
Returns undefined if the object is not of type userdata
or if the "__type" metatable key does
not exist.
In some cases, Isaac classes can be a read-only. If this is the case, the "__type" field will be prepended with "const ". This function will always strip this prefix, if it exists. For example, the class name returned for "const Vector" will be "Vector".
Parameters
Name | Type |
---|---|
object | unknown |
Returns
string
| undefined
Defined in
packages/isaacscript-common/src/functions/isaacAPIClass.ts:17
isBomb
▸ isBomb(variable
): variable is EntityBomb
Helper function to detect if a variable is of type EntityBomb
.
Parameters
Name | Type |
---|---|
variable | unknown |
Returns
variable is EntityBomb
Defined in
packages/isaacscript-common/src/functions/isaacAPIClass.ts:38
isDoor
▸ isDoor(variable
): variable is GridEntityDoor
Helper function to detect if a variable is of type GridEntityDoor
.
Parameters
Name | Type |
---|---|
variable | unknown |
Returns
variable is GridEntityDoor
Defined in
packages/isaacscript-common/src/functions/isaacAPIClass.ts:43
isEffect
▸ isEffect(variable
): variable is EntityEffect
Helper function to detect if a variable is of type EntityEffect
.
Parameters
Name | Type |
---|---|
variable | unknown |
Returns
variable is EntityEffect
Defined in
packages/isaacscript-common/src/functions/isaacAPIClass.ts:48
isEntity
▸ isEntity(variable
): variable is Entity
Helper function to detect if a variable is of type Entity
. This will return false for child
classes such as EntityPlayer
or EntityTear
.
Parameters
Name | Type |
---|---|
variable | unknown |
Returns
variable is Entity
Defined in
packages/isaacscript-common/src/functions/isaacAPIClass.ts:56
isFamiliar
▸ isFamiliar(variable
): variable is EntityFamiliar
Helper function to detect if a variable is of type EntityFamiliar
.
Parameters
Name | Type |
---|---|
variable | unknown |
Returns
variable is EntityFamiliar
Defined in
packages/isaacscript-common/src/functions/isaacAPIClass.ts:61
isGridEntity
▸ isGridEntity(variable
): variable is GridEntity
Helper function to detect if a variable is of type GridEntity
.
Parameters
Name | Type |
---|---|
variable | unknown |
Returns
variable is GridEntity
Defined in
packages/isaacscript-common/src/functions/isaacAPIClass.ts:66
isIsaacAPIClass
▸ isIsaacAPIClass(object
): object is IsaacAPIClass
Helper function to check if something is an instantiated class from the Isaac API. (All classes from the Isaac API have a type of "userdata" in Lua with a metatable key of "__type" equal to the name of the class.)
Parameters
Name | Type |
---|---|
object | unknown |
Returns
object is IsaacAPIClass
Defined in
packages/isaacscript-common/src/functions/isaacAPIClass.ts:75
isIsaacAPIClassOfType
▸ isIsaacAPIClassOfType(object
, classType
): boolean
Parameters
Name | Type |
---|---|
object | unknown |
classType | string |
Returns
boolean
Defined in
packages/isaacscript-common/src/functions/isaacAPIClass.ts:80
isKnife
▸ isKnife(variable
): variable is EntityKnife
Helper function to detect if a variable is of type EntityKnife
.
Parameters
Name | Type |
---|---|
variable | unknown |
Returns
variable is EntityKnife
Defined in
packages/isaacscript-common/src/functions/isaacAPIClass.ts:92
isLaser
▸ isLaser(variable
): variable is EntityLaser
Helper function to detect if a variable is of type EntityLaser
.
Parameters
Name | Type |
---|---|
variable | unknown |
Returns
variable is EntityLaser
Defined in
packages/isaacscript-common/src/functions/isaacAPIClass.ts:97
isNPC
▸ isNPC(variable
): variable is EntityNPC
Helper function to detect if a variable is of type EntityNPC
.
Parameters
Name | Type |
---|---|
variable | unknown |
Returns
variable is EntityNPC
Defined in
packages/isaacscript-common/src/functions/isaacAPIClass.ts:102
isPickup
▸ isPickup(variable
): variable is EntityPickup
Helper function to detect if a variable is of type EntityPickup
.
Parameters
Name | Type |
---|---|
variable | unknown |
Returns
variable is EntityPickup
Defined in
packages/isaacscript-common/src/functions/isaacAPIClass.ts:107
isPit
▸ isPit(variable
): variable is GridEntityPit
Helper function to detect if a variable is of type GridEntityPit
.
Parameters
Name | Type |
---|---|
variable | unknown |
Returns
variable is GridEntityPit
Defined in
packages/isaacscript-common/src/functions/isaacAPIClass.ts:112
isPlayer
▸ isPlayer(variable
): variable is EntityPlayer
Helper function to detect if a variable is of type EntityPlayer
.
Parameters
Name | Type |
---|---|
variable | unknown |
Returns
variable is EntityPlayer
Defined in
packages/isaacscript-common/src/functions/isaacAPIClass.ts:117
isPoop
▸ isPoop(variable
): variable is GridEntityPoop
Helper function to detect if a variable is of type GridEntityPoop
.
Parameters
Name | Type |
---|---|
variable | unknown |
Returns
variable is GridEntityPoop
Defined in
packages/isaacscript-common/src/functions/isaacAPIClass.ts:122
isPressurePlate
▸ isPressurePlate(variable
): variable is GridEntityPressurePlate
Helper function to detect if a variable is of type GridEntityPressurePlate
.
Parameters
Name | Type |
---|---|
variable | unknown |
Returns
variable is GridEntityPressurePlate
Defined in
packages/isaacscript-common/src/functions/isaacAPIClass.ts:127
isProjectile
▸ isProjectile(variable
): variable is EntityProjectile
Helper function to detect if a variable is of type EntityProjectile
.
Parameters
Name | Type |
---|---|
variable | unknown |
Returns
variable is EntityProjectile
Defined in
packages/isaacscript-common/src/functions/isaacAPIClass.ts:134
isRock
▸ isRock(variable
): variable is GridEntityRock
Helper function to detect if a variable is of type GridEntityRock
.
Parameters
Name | Type |
---|---|
variable | unknown |
Returns
variable is GridEntityRock
Defined in
packages/isaacscript-common/src/functions/isaacAPIClass.ts:139
isSpikes
▸ isSpikes(variable
): variable is GridEntitySpikes
Helper function to detect if a variable is of type GridEntitySpikes
.
Parameters
Name | Type |
---|---|
variable | unknown |
Returns
variable is GridEntitySpikes
Defined in
packages/isaacscript-common/src/functions/isaacAPIClass.ts:144
isTNT
▸ isTNT(variable
): variable is GridEntityTNT
Helper function to detect if a variable is of type GridEntityTNT
.
Parameters
Name | Type |
---|---|
variable | unknown |
Returns
variable is GridEntityTNT
Defined in
packages/isaacscript-common/src/functions/isaacAPIClass.ts:149
isTear
▸ isTear(variable
): variable is EntityTear
Helper function to detect if a variable is of type EntityTear
.
Parameters
Name | Type |
---|---|
variable | unknown |
Returns
variable is EntityTear
Defined in
packages/isaacscript-common/src/functions/isaacAPIClass.ts:154
isaacAPIClassEquals
▸ isaacAPIClassEquals(object1
, object2
, keys
): boolean
Helper function to check if an instantiated Isaac API class is equal to another one of the same type. You must provide the list of keys to check for.
Parameters
Name | Type |
---|---|
object1 | unknown |
object2 | unknown |
keys | readonly string [] |
Returns
boolean
Defined in
packages/isaacscript-common/src/functions/isaacAPIClass.ts:162