ACE3/TO_MERGE/cse/main/variables/functions/fn_getAllSetVariables.sqf
2015-01-12 23:35:40 +01:00

27 lines
947 B
Plaintext

/**
* fn_getAllSetVariables.sqf
* @Descr: Returns an 2d array of all variables that have been set on the object
* @Author: Glowbal
*
* @Arguments: [unit OBJECT, category STRING (Optional. Only get the variables from the specified category. Default is "" == all)]
* @Return: ARRAY REturns an array with the format [ [name STRING, typeName STRING, value ANY, publicFlag BOOL, peristentFlag BOOL] ]
* @PublicAPI: true
*/
private ["_object", "_return", "_val", "_category"];
_object = _this select 0;
_category = if (count _this > 1) then { _this select 1 } else { "" };
if (isnil 'CSE_OBJECT_VARIABLES_STORAGE') then {
CSE_OBJECT_VARIABLES_STORAGE = [];
};
_return = [];
{
_val = _object getvariable (_x select 0);
if (!isnil "_val") then {
if (_category == "" || _category == _x select 3) then {
_return pushback [_x select 0, typeName _val, _val, _x select 2, _x select 5];
};
};
}foreach CSE_OBJECT_VARIABLES_STORAGE;
_return