CBA_fnc_hashCreate

Description

Creates a new Hash

Parameters

_arrayArray of key-value pairs to create Hash from [Array, defaults to []]
_defaultValueDefault value.  Used when key doesn’t exist.  A key is also removed from the hash if the value is set to this default [Any, defaults to nil]

Returns

Newly created Hash [Hash]

Examples

_emptyHash = [] call CBA_fnc_hashCreate;
[_emptyHash, "frog"] call CBA_fnc_hashGet; // => nil

_pairs = [["frog", 12], ["fish", 9]];
_animalCounts = [_pairs, 0] call CBA_fnc_hashCreate;
[_animalCounts, "frog"] call CBA_fnc_hashGet; // => 12
[_animalCounts, "monkey"] call CBA_fnc_hashGet; // => 0
[_animalCounts, "monkey", 25] call CBA_fnc_hashGet; // => 25

Author

Spooner

Close