BIS_fnc_addToPairs

From Bohemia Interactive Community
Revision as of 18:03, 2 June 2019 by 7erra (talk | contribs) (Links to set and find functions)
Jump to navigation Jump to search


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