Skip to content

Array (in Lua)

These are a collection of functions for non-TypeScript users so that they can access some of useful methods offered on the Array class in the JavaScript standard library.

If you are a TypeScript user, you should never use these functions, and instead use the more idiomatic object-oriented approach.

every<T>(array, func): boolean

Defined in: packages/isaacscript-common/src/functions/arrayLua.ts:17

Helper function for non-TypeScript users to check if every element in the array is equal to a condition.

Internally, this just calls Array.every.

T

readonly T[]

(value, index, array) => boolean

boolean


filter<T>(array, func): readonly T[]

Defined in: packages/isaacscript-common/src/functions/arrayLua.ts:30

Helper function for non-TypeScript users to filter the elements in an array. Returns the filtered array.

Internally, this just calls Array.filter.

T

readonly T[]

(value, index, array) => boolean

readonly T[]


find<T>(array, func): T | undefined

Defined in: packages/isaacscript-common/src/functions/arrayLua.ts:42

Helper function for non-TypeScript users to find an element in an array.

Internally, this just calls Array.find.

T

readonly T[]

(value, index, array) => boolean

T | undefined


forEach<T>(array, func): void

Defined in: packages/isaacscript-common/src/functions/arrayLua.ts:54

Helper function for non-TypeScript users to iterate over an array.

Internally, this just calls Array.forEach.

T

readonly T[]

(value, index, array) => void

void


join(array, separator): string

Defined in: packages/isaacscript-common/src/functions/arrayLua.ts:69

Helper function for non-TypeScript users to convert an array to a string with the specified separator.

Internally, this just calls Array.join.

readonly unknown[]

string

string


map<T, U>(array, func): readonly U[]

Defined in: packages/isaacscript-common/src/functions/arrayLua.ts:79

Helper function for non-TypeScript users to convert all of the elements in an array to something else.

Internally, this just calls Array.map.

T

U

readonly T[]

(value, index, array) => U

readonly U[]


some<T>(array, func): boolean

Defined in: packages/isaacscript-common/src/functions/arrayLua.ts:92

Helper function for non-TypeScript users to check if one or more elements in the array is equal to a condition.

Internally, this just calls Array.some.

T

readonly T[]

(value, index, array) => boolean

boolean