Arma 3 Scripting

Function in Arrays

BIS_fnc_consolidateArray

Also available as Markdown and JSON, or read the original wiki page.

Description

Finds duplicates in the given array of anything and consolidates them into an array of sub-arrays

Syntax

array call BIS_fnc_consolidateArray

Parameters:

Returns: Array - array of sub-arrays in format [[value, count],...], where:

Examples

Example 1

["apple","apple","pear","pear","apple"] call BIS_fnc_consolidateArray; // return: [["apple",3],["pear",2]]

Example 2

["apple","apple",1,1,nil,nil] call BIS_fnc_consolidateArray; // return: [["apple",2],[1,2],[any,2]]