Skip to content

Array tools

A collection of utilities and tools for working with arrays.

Authors and contributors to this experimental extension: arthuro555.


This extension adds features like:

  • Combining arrays (concatenate into new array, append all children to another array)
  • Finding a value in an array (find index expression, contains condition)
  • Reversing arrays
  • Get a portion of an array (slice)
  • Add and remove lots of children at specific indices at once (fill, splice, shift, pop, add at index)
  • Randomness (shuffle children, get a random child)
  • Mathematical operations using arrays (sum of all numbers, biggest/smallest number, average number, median number)
  • Sort numbers in an array
  • String inter-operation (split string into array, join array array children to string)

Tip

Learn how to install new extensions by following a step-by-step guide.

Actions

Append all variable to another array
Appends a copy of all variables of one array to another array.

See parameters
  • Parameter 1 (🗄️ Any variable): The array to get the variables from
  • Parameter 2 (🗄️ Any variable): The variable to append the variables in

Technical note: parameters 0, 3 are internal parameters handled by GDevelop.

Combine 2 arrays
Combines all elements of 2 scene arrays into one new scene array.

See parameters
  • Parameter 1 (🗄️ Any variable): The first array
  • Parameter 2 (🗄️ Any variable): The second array
  • Parameter 3 (🗄️ Any variable): The variable to store the new array in

Technical note: parameters 0, 4 are internal parameters handled by GDevelop.

Fill array with number
Fill an element with a number.

See parameters
  • Parameter 1 (🗄️ Any variable): The array to fill
  • Parameter 2 (🔢 Number): The number to fill
  • Parameter 3 (🔢 Number): The index to start filling from
  • Parameter 4 (🔢 Number): The index to stop filling at Set to 0 to fill until the end of the array.

Technical note: parameters 0, 5 are internal parameters handled by GDevelop.

Flatten array
Replaces all arrays inside of an array with their children. For example, [[1,2], [3,4]] becomes [1,2,3,4].

See parameters
  • Parameter 1 (🗄️ Any variable): The array to flatten
  • Parameter 2 (❓ Yes or No): Deeply flatten If yes, will continue flattening until there is no arrays in the array anymore.

Technical note: parameters 0, 3 are internal parameters handled by GDevelop.

Insert variable at
Insert a variable at a specific index of an array.

See parameters
  • Parameter 1 (🗄️ Any variable): The array to insert a variable in
  • Parameter 2 (🔢 Number): The index to insert the variable at
  • Parameter 3 (🗄️ Any variable): The name of the variable to insert

Technical note: parameters 0, 4 are internal parameters handled by GDevelop.

Append all variable to another array
Appends a copy of all variables of one array to another array.

See parameters
  • Parameter 1 (👾 Object): The object the variable is from
  • Parameter 2 (🗄️ Object variable): The array to get the variables from
  • Parameter 3 (👾 Object): The object the variable is from
  • Parameter 4 (🗄️ Object variable): The variable to append the variables in

Technical note: parameters 0, 5 are internal parameters handled by GDevelop.

Combine 2 arrays
Combines all elements of 2 scene arrays into one new scene array.

See parameters
  • Parameter 1 (👾 Object): The object the variable is from
  • Parameter 2 (🗄️ Object variable): The first array
  • Parameter 3 (👾 Object): The object the variable is from
  • Parameter 4 (🗄️ Object variable): The second array
  • Parameter 5 (👾 Object): The object the variable is from
  • Parameter 6 (🗄️ Object variable): The variable to store the new array in

Technical note: parameters 0, 7 are internal parameters handled by GDevelop.

Fill array with number
Fill an element with a number.

See parameters
  • Parameter 1 (👾 Object): The object the variable is from
  • Parameter 2 (🗄️ Object variable): The array to fill
  • Parameter 3 (🔢 Number): The number to fill
  • Parameter 4 (🔢 Number): The index to start filling from
  • Parameter 5 (🔢 Number): The index to stop filling at Set to 0 to fill until the end of the array.

Technical note: parameters 0, 6 are internal parameters handled by GDevelop.

Flatten array
Replaces all arrays inside of an array with their children. For example, [[1,2], [3,4]] becomes [1,2,3,4].

See parameters
  • Parameter 1 (👾 Object): The object the variable is from
  • Parameter 2 (🗄️ Object variable): The array to flatten
  • Parameter 3 (❓ Yes or No): Deeply flatten If yes, will continue flattening until there is no arrays in the array anymore.

Technical note: parameters 0, 4 are internal parameters handled by GDevelop.

Insert variable at
Insert a variable at a specific index of an array.

See parameters
  • Parameter 1 (👾 Object): The object the variable is from
  • Parameter 2 (🗄️ Object variable): The array to insert a variable in
  • Parameter 3 (🔢 Number): The index to insert the variable at
  • Parameter 4 (👾 Object): The object the variable is from
  • Parameter 5 (🗄️ Object variable): The name of the variable to insert

Technical note: parameters 0, 6 are internal parameters handled by GDevelop.

Pop array child
Removes the last array child of an array, and stores it in another variable.

See parameters
  • Parameter 1 (👾 Object): The object the variable is from
  • Parameter 2 (🗄️ Object variable): The array to pop a child from
  • Parameter 3 (👾 Object): The object the variable is from
  • Parameter 4 (🗄️ Object variable): The variable to store the popped value into

Technical note: parameters 0, 5 are internal parameters handled by GDevelop.

Reverse an array
Reverses children of an array. The first array child becomes the last, and the last array child becomes the first.

See parameters
  • Parameter 1 (👾 Object): The object the variable is from
  • Parameter 2 (🗄️ Object variable): The array to reverse

Technical note: parameters 0, 3 are internal parameters handled by GDevelop.

Shift array child
Removes the first array child of an array, and stores it in another variable.

See parameters
  • Parameter 1 (👾 Object): The object the variable is from
  • Parameter 2 (🗄️ Object variable): The array to shift a child from
  • Parameter 3 (👾 Object): The object the variable is from
  • Parameter 4 (🗄️ Object variable): The variable to store the shifted value into

Technical note: parameters 0, 5 are internal parameters handled by GDevelop.

Shuffle array
Shuffles all children of an array.

See parameters
  • Parameter 1 (👾 Object): The object the variable is from
  • Parameter 2 (🗄️ Object variable): The array to shuffle

Technical note: parameters 0, 3 are internal parameters handled by GDevelop.

Slice an array
Copies a portion of a scene array variable into a new scene array variable.

See parameters
  • Parameter 1 (👾 Object): The object the variable is from
  • Parameter 2 (🗄️ Object variable): The array to take a slice from
  • Parameter 3 (👾 Object): The object the variable is from
  • Parameter 4 (🗄️ Object variable): The array to store the slice into
  • Parameter 5 (🔢 Number): The index to start the slice from
  • Parameter 6 (🔢 Number): The index to end the slice at Set to 0 to copy all of the array. If you use a negative value, the index will be selected beginning from the end.
    For example, slicing an array with 5 elements from 0 to -1 would take only elements from indices 0 to 3.

Technical note: parameters 0, 7 are internal parameters handled by GDevelop.

Sort an array
Sort an array of number from smallest to biggest.

See parameters
  • Parameter 1 (👾 Object): The object the variable is from
  • Parameter 2 (🗄️ Object variable): The array to sort

Technical note: parameters 0, 3 are internal parameters handled by GDevelop.

Splice an array
Cuts a portion of an array off.

See parameters
  • Parameter 1 (👾 Object): The object the variable is from
  • Parameter 2 (🗄️ Object variable): The array to remove items from
  • Parameter 3 (🔢 Number): The index to start removing from If you use a negative value, the index will be selected beginning from the end.
  • Parameter 4 (🔢 Number): The amount of elements to remove Set to 0 to remove until the end of the array.

Technical note: parameters 0, 5 are internal parameters handled by GDevelop.

Split string into array
Split a string into an array of strings via a separator.

See parameters
  • Parameter 1 (string): The string to split
  • Parameter 2 (string): The separator to use to split the string For example, if you have a string "Hello World", and the separator is a space (" "), the resulting array would be ["Hello", "World"]. If the separator is an empty string (""), it will make an element per character (["H", "e", "l", "l", "o", " ", "W", "o", "r", "l", "d"]).
  • Parameter 3 (👾 Object): The object the variable is from
  • Parameter 4 (🗄️ Object variable): Array where to store the results

Technical note: parameters 0, 5 are internal parameters handled by GDevelop.

Pop array child
Removes the last array child of an array, and stores it in another variable.

See parameters
  • Parameter 1 (🗄️ Any variable): The array to pop a child from
  • Parameter 2 (🗄️ Any variable): The variable to store the popped value into

Technical note: parameters 0, 3 are internal parameters handled by GDevelop.

Reverse an array
Reverses children of an array. The first array child becomes the last, and the last array child becomes the first.

See parameters
  • Parameter 1 (🗄️ Any variable): The array to reverse

Technical note: parameters 0, 2 are internal parameters handled by GDevelop.

Shift array child
Removes the first array child of an array, and stores it in another variable.

See parameters
  • Parameter 1 (🗄️ Any variable): The array to shift a child from
  • Parameter 2 (🗄️ Any variable): The variable to store the shifted value into

Technical note: parameters 0, 3 are internal parameters handled by GDevelop.

Shuffle array
Shuffles all children of an array.

See parameters
  • Parameter 1 (🗄️ Any variable): The array to shuffle

Technical note: parameters 0, 2 are internal parameters handled by GDevelop.

Slice an array
Copies a portion of a scene array variable into a new scene array variable.

See parameters
  • Parameter 1 (🗄️ Any variable): The array to take a slice from
  • Parameter 2 (🗄️ Any variable): The array to store the slice into
  • Parameter 3 (🔢 Number): The index to start the slice from
  • Parameter 4 (🔢 Number): The index to end the slice at Set to 0 to copy all of the array. If you use a negative value, the index will be selected beginning from the end.
    For example, slicing an array with 5 elements from 0 to -1 would take only elements from indices 0 to 3.

Technical note: parameters 0, 5 are internal parameters handled by GDevelop.

Sort an array
Sort an array of number from smallest to biggest.

See parameters
  • Parameter 1 (🗄️ Any variable): The array to sort

Technical note: parameters 0, 2 are internal parameters handled by GDevelop.

Splice an array
Cuts a portion of an array off.

See parameters
  • Parameter 1 (🗄️ Any variable): The array to remove items from
  • Parameter 2 (🔢 Number): The index to start removing from If you use a negative value, the index will be selected beginning from the end.
  • Parameter 3 (🔢 Number): The amount of elements to remove Set to 0 to remove until the end of the array.

Technical note: parameters 0, 4 are internal parameters handled by GDevelop.

Split string into array
Split a string into an array of strings via a separator.

See parameters
  • Parameter 1 (string): The string to split
  • Parameter 2 (string): The separator to use to split the string For example, if you have a string "Hello World", and the separator is a space (" "), the resulting array would be ["Hello", "World"]. If the separator is an empty string (""), it will make an element per character (["H", "e", "l", "l", "o", " ", "W", "o", "r", "l", "d"]).
  • Parameter 3 (🗄️ Any variable): Array where to store the results

Technical note: parameters 0, 4 are internal parameters handled by GDevelop.

Conditions

Array has number
Checks if an array contains a specific number.

See parameters
  • Parameter 1 (🗄️ Any variable): Array to search the value in
  • Parameter 2 (🔢 Number): The number to search

Technical note: parameters 0, 3 are internal parameters handled by GDevelop.

Array has string
Checks if an array contains a specific string.

See parameters
  • Parameter 1 (🗄️ Any variable): Array to search the value in
  • Parameter 2 (string): The text to search

Technical note: parameters 0, 3 are internal parameters handled by GDevelop.

Index of number
Compare The index of the first variable that equals to a specific number in an array.

See parameters
  • Parameter 1: 🟰 Relational operator
  • Parameter 2 (🔢 Number): Value to compare
  • Parameter 3 (🗄️ Any variable): Array to search the value in
  • Parameter 4 (🔢 Number): Number to search in the array

Technical note: parameters 0, 5 are internal parameters handled by GDevelop.

Index of text
Compare The index of the first variable that equals to a specific text in an array.

See parameters
  • Parameter 1: 🟰 Relational operator
  • Parameter 2 (🔢 Number): Value to compare
  • Parameter 3 (🗄️ Any variable): Array to search the value in
  • Parameter 4 (string): String to search in the array

Technical note: parameters 0, 5 are internal parameters handled by GDevelop.

Last index of number
Compare The index of the last variable that equals to a specific number in an array.

See parameters
  • Parameter 1: 🟰 Relational operator
  • Parameter 2 (🔢 Number): Value to compare
  • Parameter 3 (🗄️ Any variable): Array to search the value in
  • Parameter 4 (🔢 Number): Number to search in the array

Technical note: parameters 0, 5 are internal parameters handled by GDevelop.

Last index of text
Compare The index of the last variable that equals to a specific text in an array.

See parameters
  • Parameter 1: 🟰 Relational operator
  • Parameter 2 (🔢 Number): Value to compare
  • Parameter 3 (🗄️ Any variable): Array to search the value in
  • Parameter 4 (string): String to search in the array

Technical note: parameters 0, 5 are internal parameters handled by GDevelop.

Array has number
Checks if an array contains a specific number.

See parameters
  • Parameter 1 (👾 Object): The object the variable is from
  • Parameter 2 (🗄️ Object variable): Array to search the value in
  • Parameter 3 (🔢 Number): The number to search

Technical note: parameters 0, 4 are internal parameters handled by GDevelop.

Array has string
Checks if an array contains a specific string.

See parameters
  • Parameter 1 (👾 Object): The object the variable is from
  • Parameter 2 (🗄️ Object variable): Array to search the value in
  • Parameter 3 (string): The text to search

Technical note: parameters 0, 4 are internal parameters handled by GDevelop.

Index of number
Compare The index of the first variable that equals to a specific number in an array.

See parameters
  • Parameter 1: 🟰 Relational operator
  • Parameter 2 (🔢 Number): Value to compare
  • Parameter 3 (👾 Object): The object the variable is from
  • Parameter 4 (🗄️ Object variable): Array to search the value in
  • Parameter 5 (🔢 Number): Number to search in the array

Technical note: parameters 0, 6 are internal parameters handled by GDevelop.

Index of text
Compare The index of the first variable that equals to a specific text in an array.

See parameters
  • Parameter 1: 🟰 Relational operator
  • Parameter 2 (🔢 Number): Value to compare
  • Parameter 3 (👾 Object): The object the variable is from
  • Parameter 4 (🗄️ Object variable): Array to search the value in
  • Parameter 5 (string): String to search in the array

Technical note: parameters 0, 6 are internal parameters handled by GDevelop.

Last index of number
Compare The index of the last variable that equals to a specific number in an array.

See parameters
  • Parameter 1: 🟰 Relational operator
  • Parameter 2 (🔢 Number): Value to compare
  • Parameter 3 (👾 Object): The object the variable is from
  • Parameter 4 (🗄️ Object variable): Array to search the value in
  • Parameter 5 (🔢 Number): Number to search in the array

Technical note: parameters 0, 6 are internal parameters handled by GDevelop.

Last index of text
Compare The index of the last variable that equals to a specific text in an array.

See parameters
  • Parameter 1: 🟰 Relational operator
  • Parameter 2 (🔢 Number): Value to compare
  • Parameter 3 (👾 Object): The object the variable is from
  • Parameter 4 (🗄️ Object variable): Array to search the value in
  • Parameter 5 (string): String to search in the array

Technical note: parameters 0, 6 are internal parameters handled by GDevelop.

Get and remove last variable from array (as number)
Compare Removes the last array child of an array, and return it as a number.

See parameters
  • Parameter 1: 🟰 Relational operator
  • Parameter 2 (🔢 Number): Value to compare
  • Parameter 3 (👾 Object): The object the variable is from
  • Parameter 4 (🗄️ Object variable): Array to pop a child from

Technical note: parameters 0, 5 are internal parameters handled by GDevelop.

Random number in array
Compare Returns a random number of an array of numbers.

See parameters
  • Parameter 1: 🟰 Relational operator
  • Parameter 2 (🔢 Number): Value to compare
  • Parameter 3 (👾 Object): The object the variable is from
  • Parameter 4 (🗄️ Object variable): Array to get a number from

Technical note: parameters 0, 5 are internal parameters handled by GDevelop.

Random string in array
Compare a random string of an array of strings.

See parameters
  • Parameter 1: 🟰 Relational operator
  • Parameter 2 (string): Value to compare
  • Parameter 3 (👾 Object): The object the variable is from
  • Parameter 4 (🗄️ Object variable): Array to get a string from

Technical note: parameters 0, 5 are internal parameters handled by GDevelop.

Get and remove last variable from array (as number)
Compare Removes the last array child of an array, and return it as a number.

See parameters
  • Parameter 1: 🟰 Relational operator
  • Parameter 2 (🔢 Number): Value to compare
  • Parameter 3 (🗄️ Any variable): Array to pop a child from

Technical note: parameters 0, 4 are internal parameters handled by GDevelop.

Random number in array
Compare Returns a random number of an array of numbers.

See parameters
  • Parameter 1: 🟰 Relational operator
  • Parameter 2 (🔢 Number): Value to compare
  • Parameter 3 (🗄️ Any variable): Array to get a number from

Technical note: parameters 0, 4 are internal parameters handled by GDevelop.

Random string in array
Compare a random string of an array of strings.

See parameters
  • Parameter 1: 🟰 Relational operator
  • Parameter 2 (string): Value to compare
  • Parameter 3 (🗄️ Any variable): Array to get a string from

Technical note: parameters 0, 4 are internal parameters handled by GDevelop.

Expressions

Expression Description
ArrayTools::IndexOf(variable, number) Return The index of the first variable that equals to a specific number in an array.
🗄️ Any variable Array to search the value in
🔢 Number Number to search in the array
ArrayTools::IndexOfStr(variable, string) Return The index of the first variable that equals to a specific text in an array.
🗄️ Any variable Array to search the value in
string String to search in the array
ArrayTools::Join(variable, string) Returns a string made from all strings in an array.
🗄️ Any variable The name of the array to join into a string
string Optional separator text between each element
ArrayTools::LastIndexOf(variable, number) Return The index of the last variable that equals to a specific number in an array.
🗄️ Any variable Array to search the value in
🔢 Number Number to search in the array
ArrayTools::LastIndexOfStr(variable, string) Return The index of the last variable that equals to a specific text in an array.
🗄️ Any variable Array to search the value in
string String to search in the array
ArrayTools::Max(variable) Gets the biggest number in an array.
🗄️ Any variable The array
ArrayTools::Mean(variable) Gets the average number in an array.
🗄️ Any variable The array
ArrayTools::Median(variable) Gets the median number in an array.
🗄️ Any variable The array
ArrayTools::Min(variable) Gets the smallest number in an array.
🗄️ Any variable The array
ArrayTools::ObjectIndexOf(object, object variable, number) Return The index of the first variable that equals to a specific number in an array.
👾 Object The object the variable is from
🗄️ Object variable Array to search the value in
🔢 Number Number to search in the array
ArrayTools::ObjectIndexOfStr(object, object variable, string) Return The index of the first variable that equals to a specific text in an array.
👾 Object The object the variable is from
🗄️ Object variable Array to search the value in
string String to search in the array
ArrayTools::ObjectJoin(object, object variable, string) Returns a string made from all strings in an array.
👾 Object The object the variable is from
🗄️ Object variable The name of the array to join into a string
string Optional separator text between each element
ArrayTools::ObjectLastIndexOf(object, object variable, number) Return The index of the last variable that equals to a specific number in an array.
👾 Object The object the variable is from
🗄️ Object variable Array to search the value in
🔢 Number Number to search in the array
ArrayTools::ObjectLastIndexOfStr(object, object variable, string) Return The index of the last variable that equals to a specific text in an array.
👾 Object The object the variable is from
🗄️ Object variable Array to search the value in
string String to search in the array
ArrayTools::ObjectMax(object, object variable) Gets the biggest number in an array.
👾 Object The object the variable is from
🗄️ Object variable The array
ArrayTools::ObjectMean(object, object variable) Gets the average number in an array.
👾 Object The object the variable is from
🗄️ Object variable The array
ArrayTools::ObjectMedian(object, object variable) Gets the median number in an array.
👾 Object The object the variable is from
🗄️ Object variable The array
ArrayTools::ObjectMin(object, object variable) Gets the smallest number in an array.
👾 Object The object the variable is from
🗄️ Object variable The array
ArrayTools::ObjectPopNumber(object, object variable) Return Removes the last array child of an array, and return it as a number.
👾 Object The object the variable is from
🗄️ Object variable Array to pop a child from
ArrayTools::ObjectPopString(object, object variable) Removes the last array child of an array, and return it as a string.
👾 Object The object the variable is from
🗄️ Object variable Array to pop a child from
ArrayTools::ObjectRandomNumberInArray(object, object variable) Return Returns a random number of an array of numbers.
👾 Object The object the variable is from
🗄️ Object variable Array to get a number from
ArrayTools::ObjectRandomStringInArray(object, object variable) Return a random string of an array of strings.
👾 Object The object the variable is from
🗄️ Object variable Array to get a string from
ArrayTools::ObjectShiftNumber(object, object variable) Removes the first array child of an array, and return it as a number.
👾 Object The object the variable is from
🗄️ Object variable Array to shift a child from
ArrayTools::ObjectShiftString(object, object variable) Removes the first array child of an array, and return it as a string.
👾 Object The object the variable is from
🗄️ Object variable Array to shift a child from
ArrayTools::ObjectSum(object, object variable) Get the sum of all numbers in an array.
👾 Object The object the variable is from
🗄️ Object variable The array
ArrayTools::PopNumber(variable) Return Removes the last array child of an array, and return it as a number.
🗄️ Any variable Array to pop a child from
ArrayTools::PopString(variable) Removes the last array child of an array, and return it as a string.
🗄️ Any variable Array to pop a child from
ArrayTools::RandomNumberInArray(variable) Return Returns a random number of an array of numbers.
🗄️ Any variable Array to get a number from
ArrayTools::RandomStringInArray(variable) Return a random string of an array of strings.
🗄️ Any variable Array to get a string from
ArrayTools::ShiftNumber(variable) Removes the first array child of an array, and return it as a number.
🗄️ Any variable Array to shift a child from
ArrayTools::ShiftString(variable) Removes the first array child of an array, and return it as a string.
🗄️ Any variable Array to shift a child from
ArrayTools::Sum(variable) Get the sum of all numbers in an array.
🗄️ Any variable The array

This page is an auto-generated reference page about the Array tools extension, made by the community of GDevelop, the open-source, cross-platform game engine designed for everyone. Learn more about all GDevelop community-made extensions here.