BIS fnc addToPairs: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
m (template:command argument fix)
(Links to set and find functions)
Line 46: Line 46:
____________________________________________________________________________________________
____________________________________________________________________________________________


| |SEEALSO=
| [[BIS_fnc_findInPairs]], [[BIS_fnc_setToPairs]] |SEEALSO=


}}
}}

Revision as of 17:03, 2 June 2019


Hover & click on the images for description

Description

Description:
/*

	Description:
	Adds given value to pair array, stored under unique key.

	If value is found:
	a) both values are scalars: values are added and stored as a single scalar
	b) one or both values are array: values are added and stored as a single array
	c) anything else: an array is created and both values are stored there

	Remarks:
	Function by default modifies the input array. This can be overrriden by setting '_copyArray' param to true.

	Syntax:
	_pairs:array = [_pairs:array,_key:string,_value:number,_copyArray:bool] call BIS_fnc_addToPairs;

	Example:
	[["apple",3],["pear",12]] = [[["apple",3],["pear",2]],"pear",10] call BIS_fnc_addToPairs;
	[["apple",1],["pear",2]] = [[["apple",3],["pear",2]],"apple",-2] call BIS_fnc_addToPairs;
	[["greetings",["Hello!","Hi!"]],["rudewords",""]] = [[["greetings","Hello!"],["rudewords",""]],"greetings","Hi!"] call BIS_fnc_addToPairs;
*/

#define SCALAR		(typeName 123)
#define ARRAY		(typeName [])

(Placeholder description extracted from the function header by BIS_fnc_exportFunctionsToWiki)
Execution:
call
Groups:
Uncategorised

Syntax

Syntax:
Syntax needed
Return Value:
Return value needed

Examples

Example 1:

Additional Information

See also:
BIS_fnc_findInPairsBIS_fnc_setToPairs

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

Notes

Bottom Section