Iterate through all keys and values in a Hash. If function returns false, the key is removed from the hash (just like `[] select {}`)
Data passed to the function on each iteration,
See CBA_fnc_hashCreate.
_hash | Hash to iterate [Array which is a Hash structure] |
_code | Function to call with each pair which returns a bool (false will remove key from hash) [Code] |
Number of removed entrys [Number]
_hash = [[["A1", 1], ["A2", 1], ["B", 2], ["C", 3], ["D1", 4], ["D2", 4], ["E1", 5], ["E2", 5]]] call CBA_fnc_hashCreate; _removeOddValues = { diag_log format ["Key: %1, Value: %2", _key, _value]; ((_value % 2) == 0) }; _removedCount = [_hash, _removeOddValues] call CBA_fnc_hashFilter;
PabstMirror