ACE3/addons/common/functions/fnc_hashListSelect.sqf

29 lines
636 B
Plaintext
Raw Normal View History

2015-01-14 21:29:52 +00:00
//fnc_hashListSelect.sqf
#include "script_component.hpp"
2015-05-14 18:06:06 +00:00
private ["_hash", "_keys", "_hashes", "_values"];
2015-01-14 21:29:52 +00:00
2015-05-14 18:06:06 +00:00
PARAMS_2(_hashList,_index);
2015-01-14 21:29:52 +00:00
ERRORDATA(2);
_hash = nil;
try {
2015-02-19 18:14:52 +00:00
if(VALIDHASH(_hashList)) then {
_keys = _hashList select 0;
_hashes = _hashList select 1;
if(_index < (count _hashes)) then {
_values = _hashes select _index;
2015-01-14 21:29:52 +00:00
2015-02-19 18:14:52 +00:00
_hash = [_keys, _values, 1];
} else {
ERROR("Index of hashlist is out of range");
};
} else {
ERROR("Input hashlist is not valid");
};
2015-01-14 21:29:52 +00:00
} catch {
2015-02-19 18:14:52 +00:00
HANDLECATCH;
2015-01-14 21:29:52 +00:00
};
2015-05-15 19:54:02 +00:00
if (isNil "_hash") exitWith { nil };
2015-01-14 21:29:52 +00:00
_hash;