BIS fnc addToPairs: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
m (rollback)
m (template:command argument fix)
Line 33: Line 33:
#define ARRAY (typeName [])
#define ARRAY (typeName [])


</pre><small>''(Placeholder description extracted from the function header by [[BIS_fnc_exportFunctionsToWiki]])''</small> |= Description
</pre><small>''(Placeholder description extracted from the function header by [[BIS_fnc_exportFunctionsToWiki]])''</small> |DESCRIPTION=
____________________________________________________________________________________________
____________________________________________________________________________________________


| <!-- [] call [[BIS_fnc_addToPairs]]; --> |= Syntax
| <!-- [] call [[BIS_fnc_addToPairs]]; --> |SYNTAX=


|p1= |= Parameter 1
|p1= |= Parameter 1


| |= Return value
| |RETURNVALUE=
____________________________________________________________________________________________
____________________________________________________________________________________________


Line 46: Line 46:
____________________________________________________________________________________________
____________________________________________________________________________________________


| |= See also
| |SEEALSO=


}}
}}

Revision as of 11:26, 7 April 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:
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

Notes

Bottom Section