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
every
▸ every<T>(array, func): boolean
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
| Name |
|---|
T |
Parameters
| Name | Type |
|---|---|
array | readonly T[] |
func | (value: T, index: number, array: readonly T[]) => boolean |
Returns
boolean
Defined in
packages/isaacscript-common/src/functions/arrayLua.ts:17
filter
▸ filter<T>(array, func): readonly T[]
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
| Name |
|---|
T |
Parameters
| Name | Type |
|---|---|
array | readonly T[] |
func | (value: T, index: number, array: readonly T[]) => boolean |
Returns
readonly T[]
Defined in
packages/isaacscript-common/src/functions/arrayLua.ts:30
find
▸ find<T>(array, func): T | undefined
Helper function for non-TypeScript users to find an element in an array.
Internally, this just calls Array.find.
Type parameters
| Name |
|---|
T |
Parameters
| Name | Type |
|---|---|
array | readonly T[] |
func | (value: T, index: number, array: readonly T[]) => boolean |
Returns
T | undefined
Defined in
packages/isaacscript-common/src/functions/arrayLua.ts:42
forEach
▸ forEach<T>(array, func): void
Helper function for non-TypeScript users to iterate over an array.
Internally, this just calls Array.forEach.
Type parameters
| Name |
|---|
T |
Parameters
| Name | Type |
|---|---|
array | readonly T[] |
func | (value: T, index: number, array: readonly T[]) => void |
Returns
void
Defined in
packages/isaacscript-common/src/functions/arrayLua.ts:54
join
▸ join<T>(array, separator): string
Helper function for non-TypeScript users to convert an array to a string with the specified separator.
Internally, this just calls Array.join.
Type parameters
| Name |
|---|
T |
Parameters
| Name | Type |
|---|---|
array | readonly T[] |
separator | string |
Returns
string
Defined in
packages/isaacscript-common/src/functions/arrayLua.ts:69
map
▸ map<T, U>(array, func): readonly U[]
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
| Name |
|---|
T |
U |
Parameters
| Name | Type |
|---|---|
array | readonly T[] |
func | (value: T, index: number, array: readonly T[]) => U |
Returns
readonly U[]
Defined in
packages/isaacscript-common/src/functions/arrayLua.ts:79
some
▸ some<T>(array, func): boolean
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
| Name |
|---|
T |
Parameters
| Name | Type |
|---|---|
array | readonly T[] |
func | (value: T, index: number, array: readonly T[]) => boolean |
Returns
boolean