BIS fnc consolidateArray: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
m (Text replacement - "\| *(arg|eff|mp|serverExec|gr[0-9]) *= *(.*) * *\|([^=]{12})" to "|$1=$2 |descr=$3")
m (Text replacement - "\| *arma3 * * *\| *([0-2]\.[0-9]{2}) * " to "|game1= arma3 |version1= $1 ")
Line 1: Line 1:
{{RV|type=function
{{RV|type=function


| arma3
|game1= arma3
 
|version1= 0.76
|0.76


|gr1= Arrays
|gr1= Arrays

Revision as of 23:48, 13 June 2021

Hover & click on the images for description

Description

Description:
Finds duplicities in the given array of anything and consolidates them into an array of sub-arrays
Execution:
call
Groups:
Arrays

Syntax

Syntax:
array call BIS_fnc_consolidateArray
Parameters:
array: Array - array of anything
Return Value:
Array - array of sub-arrays in format [[value, count],...], where:
  • value: Anything - consolidated element
  • count: Number - occurrence count

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]]

Additional Information

See also:
See also needed

Notes

Report bugs on the Feedback Tracker and/or discuss them on the Arma Discord or on the Forums.
Only post proven facts here! Add Note