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.
Functions
Section titled “Functions”every()
Section titled “every()”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.
Type Parameters
Section titled “Type Parameters”T
Parameters
Section titled “Parameters”readonly T[]
(value, index, array) => boolean
Returns
Section titled “Returns”boolean
filter()
Section titled “filter()”filter<
T>(array,func): readonlyT[]
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.
Type Parameters
Section titled “Type Parameters”T
Parameters
Section titled “Parameters”readonly T[]
(value, index, array) => boolean
Returns
Section titled “Returns”readonly T[]
find()
Section titled “find()”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.
Type Parameters
Section titled “Type Parameters”T
Parameters
Section titled “Parameters”readonly T[]
(value, index, array) => boolean
Returns
Section titled “Returns”T | undefined
forEach()
Section titled “forEach()”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.
Type Parameters
Section titled “Type Parameters”T
Parameters
Section titled “Parameters”readonly T[]
(value, index, array) => void
Returns
Section titled “Returns”void
join()
Section titled “join()”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.
Parameters
Section titled “Parameters”readonly unknown[]
separator
Section titled “separator”string
Returns
Section titled “Returns”string
map<
T,U>(array,func): readonlyU[]
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.
Type Parameters
Section titled “Type Parameters”T
U
Parameters
Section titled “Parameters”readonly T[]
(value, index, array) => U
Returns
Section titled “Returns”readonly U[]
some()
Section titled “some()”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.
Type Parameters
Section titled “Type Parameters”T
Parameters
Section titled “Parameters”readonly T[]
(value, index, array) => boolean
Returns
Section titled “Returns”boolean
