Skip to content

Instantly share code, notes, and snippets.

@bosoy
Last active December 9, 2017 19:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bosoy/476057dcd18a9156e2a8c90b170c3d93 to your computer and use it in GitHub Desktop.
Save bosoy/476057dcd18a9156e2a8c90b170c3d93 to your computer and use it in GitHub Desktop.
аналог configclasses из а3
/*
Autor^ Dimon UA
Description:
Returns an array of config entries which meet criteria in condition code.
Command iterates through all available config sub classes of the given config class.
Current looked at config is stored in _x variable (similar to alternative count command implementation).
Condition has to return true in order for the looked at config to be added to the resulting array.
Syntax:
[config,condition] call fnc_configClasses
Parameters:
config: Config
condition: String
Return Value:
Array - Array of Configs
Example: [(configfile >> "cfgweapons"),"isclass _x && getnumber (_x >> 'scope') == 2 && getnumber (_x >> 'type') < 5"] call fnc_configclasses
*/
_cnfg = _this select 0;
_param = _this select 1;
_array = [];
for "_i" from 0 to (count _cnfg)-1 do
{
_x = _cnfg select _i;
_result = call compile _param;
if _result then {_array set [count _array,_x]};
};
_array
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment