Arma 3 Scripting

merge

  • Arma 3 v2.02

Command · Markdown · JSON · original wiki page

Description

Merges two HashMaps.

Syntax

Syntax 1

hashMap1 merge hashMap2

Parameters:

Returns: Nothing

Syntax 2

hashMap1 merge [hashMap2, overwriteExisting]

Parameters:

Returns: Nothing

Examples

Example 1

_hashMap merge _otherHashMap;

Example 2

private _hashmap1 = ["cow", "cat", "chicken"] createHashMapFromArray [100, 200, 200];
private _hashmap2 = ["cow", "cat", "chicken", "camel"] createHashMapFromArray [150, 300, 400, 800];
_hashmap1 merge _hashmap2; // _hashmap is [["cow",100],["cat",200],["chicken",200],["camel",800]]

Example 3

private _hashmap1 = ["cow", "cat", "chicken"] createHashMapFromArray [100, 200, 200];
private _hashmap2 = ["cow", "cat", "chicken", "camel"] createHashMapFromArray [150, 300, 400, 800];
_hashmap1 merge [_hashmap2, true]; // _hashmap is [["cow",150],["cat",300],["chicken",400],["camel",800]]

Example 4

private _hashmap1 = ["cow", "cat", "chicken"] createHashMapFromArray [100, 200, 200];
private _hashmap2 = ["cow", "cat", "chicken", "camel"] createHashMapFromArray [150, 300, 400, 800];
_hashmap1 merge [_hashmap2, false]; // _hashmap is [["cow",100],["cat",200],["chicken",200],["camel",800]] as Syntax 1

See also

insert · set