BIS fnc consolidateArray: Difference between revisions
Jump to navigation
Jump to search
Lou Montana (talk | contribs) m (Text replacement - " \|p([0-9]{1,2})=([^ ]+) + \| *(\[\[Arr.+) * " to " |p$1=$2 |r1=$3 ") |
Lou Montana (talk | contribs) m (Some wiki formatting) |
||
(6 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
{{RV|type=function | {{RV|type=function | ||
| arma3 | |game1= arma3 | ||
|version1= 0.76 | |||
|0.76 | |||
|gr1= Arrays | |gr1= Arrays | ||
|Finds | |descr= Finds duplicates in the given array of anything and consolidates them into an array of sub-arrays | ||
|s1= | |s1= array call [[BIS_fnc_consolidateArray]] | ||
|p1= array: [[Array]] - array of anything | |p1= array: [[Array]] - array of anything | ||
|r1=[[Array]] - array of sub-arrays in format [<nowiki/>[value, count],...], where: | |r1= [[Array]] - array of sub-arrays in format [<nowiki/>[value, count],...], where: | ||
* value: [[Anything]] - consolidated element | * value: [[Anything]] - consolidated element | ||
* count: [[Number]] - occurrence count | * count: [[Number]] - occurrence count | ||
|x1= < | |x1= <sqf>["apple","apple","pear","pear","apple"] call BIS_fnc_consolidateArray; // return: [["apple",3],["pear",2]]</sqf> | ||
|x2= < | |x2= <sqf>["apple","apple",1,1,nil,nil] call BIS_fnc_consolidateArray; // return: [["apple",2],[1,2],[any,2]]</sqf> | ||
|seealso= | |||
}} | }} |
Latest revision as of 13:58, 13 July 2022
Description
- Description:
- Finds duplicates 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:
Examples
- Example 1:
- ["apple","apple","pear","pear","apple"] call BIS_fnc_consolidateArray; // return: [["apple",3],["pear",2]]
- Example 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