BIS fnc consolidateArray: Difference between revisions
Jump to navigation
Jump to search
Lou Montana (talk | contribs) m (Text replacement - " *\|= * " to " ") |
Lou Montana (talk | contribs) m (Text replacement - " *\| *([Cc]omments|COMMENTS|[Gg]ame [Nn]ame|Game [Vv]ersion|Game Version \(number surrounded by NO SPACES\)|Multiplayer Arguments \("local" or "global"\)|Multiplayer Effects \("local" or "global"\)|Multiplayer Execution \("server" o...) |
||
Line 1: | Line 1: | ||
{{Function | {{Function | ||
| arma3 | | arma3 | ||
|0.76 | |0.76 | ||
|gr1= Arrays | |gr1= Arrays | ||
|Finds duplicities in the given array of anything and consolidates them into an array of sub-arrays | |Finds duplicities in the given array of anything and consolidates them into an array of sub-arrays | ||
| array call [[BIS_fnc_consolidateArray]] | | array call [[BIS_fnc_consolidateArray]] | ||
|p1= array: [[Array]] - array of anything | |p1= array: [[Array]] - array of anything | ||
| [[Array]] - array of sub-arrays in format [<nowiki/>[value, count],...], where: | | [[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= <code>["apple","apple","pear","pear","apple"] [[call]] [[BIS_fnc_consolidateArray]]; // Return: [<nowiki/>["apple",3],["pear",2]]</code> | |x1= <code>["apple","apple","pear","pear","apple"] [[call]] [[BIS_fnc_consolidateArray]]; // Return: [<nowiki/>["apple",3],["pear",2]]</code> | ||
|x2= <code>["apple","apple",1,1,[[nil]],[[nil]]] [[call]] [[BIS_fnc_consolidateArray]]; // Return: [<nowiki/>["apple",2],[1,2],[any,2]]</code> | |x2= <code>["apple","apple",1,1,[[nil]],[[nil]]] [[call]] [[BIS_fnc_consolidateArray]]; // Return: [<nowiki/>["apple",2],[1,2],[any,2]]</code> | ||
| | | | ||
}} | }} |
Revision as of 22:36, 17 January 2021
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:
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