{"name":"createHashMapFromArray","operator":null,"title":"createHashMapFromArray","type":"command","url":"https://community.bistudio.com/wiki/createHashMapFromArray","revid":377214,"updated":"2026-01-02T00:12:06Z","groups":["HashMap","Arrays"],"status":"ok","replaced_by":[],"games":[{"game":"arma3","name":"Arma 3","version":"2.02"}],"since":{"game":"arma3","name":"Arma 3","version":"2.02"},"arma3_since":"2.02","branch":null,"locality":{"argument":null,"effect":null,"server_exec":false},"exec":null,"description":"Creates a new HashMap and initializes it from a key-value pair array","syntaxes":[{"syntax":"createHashMapFromArray [[key1, value1], [key2, value2], ...]","since":null,"effect":null,"exec":null,"params":[{"name":"keyN","type":"HashMapKey","optional":false,"default":null,"description":null,"types":["HashMapKey"],"since":null,"text":"keyN: HashMapKey"},{"name":"valueN","type":"Anything","optional":false,"default":null,"description":null,"types":["Anything"],"since":null,"text":"valueN: Anything"}],"returns":{"type":"HashMap","types":["HashMap"],"description":null,"text":"HashMap"},"form":"unary","operator":null,"left":null,"right":{"text":"[[key1, value1], [key2, value2], ...]","types":["Array"]}},{"syntax":"keys createHashMapFromArray values","since":"arma3 2.04","effect":null,"exec":null,"params":[{"name":"keys","type":"Array of HashMapKeys","optional":false,"default":null,"description":null,"types":["Array","HashMapKey"],"since":null,"text":"keys: Array of HashMapKeys"},{"name":"values","type":"Array of Anything","optional":false,"default":null,"description":"Array of Anything\n\n> [!NOTE]\n> Size of *keys* and size of *values* arrays do not need to be equal. Missing values will be filled with nil.","types":["Array","Anything"],"since":null,"text":"values: Array of Anything\n\n> [!NOTE]\n> Size of *keys* and size of *values* arrays do not need to be equal. Missing values will be filled with nil."}],"returns":{"type":"HashMap","types":["HashMap"],"description":null,"text":"HashMap"},"form":"binary","operator":null,"left":{"text":"keys","types":["Array","HashMapKey"]},"right":{"text":"values","types":["Array","Anything"]}}],"examples":[{"text":"```sqf\ncreateHashMapFromArray [[\"a\", 1], [\"b\", 2], [\"c\", 3]];\n```","code":["createHashMapFromArray [[\"a\", 1], [\"b\", 2], [\"c\", 3]];"]},{"text":"```sqf\n[1, 2, 3, 4] createHashMapFromArray []; // returns [[1, <null>], [2, <null>], [4, <null>], [3, <null>]]\n```","code":["[1, 2, 3, 4] createHashMapFromArray []; // returns [[1, <null>], [2, <null>], [4, <null>], [3, <null>]]"]},{"text":"```sqf\n[1, 2, 3] createHashMapFromArray [\"one\", \"two\", \"three\", \"four\"]; // returns [[1, \"one\"], [2, \"two\"], [3, \"three\"]]\n```","code":["[1, 2, 3] createHashMapFromArray [\"one\", \"two\", \"three\", \"four\"]; // returns [[1, \"one\"], [2, \"two\"], [3, \"three\"]]"]}],"multiplayer":null,"problems":null,"aliases":[],"see_also":["createHashMap"],"notes":[],"categories":["Arma 3: New Scripting Commands","Arma 3: Scripting Commands","Command Group: Arrays","Command Group: HashMap","Introduced with Arma 3 version 2.02","Scripting Commands"]}