ACE3/addons/common/functions/fnc_getAllDefinedSetVariables.sqf

30 lines
990 B
Plaintext
Raw Normal View History

2015-01-16 23:21:47 +00:00
/**
* 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
*/
2015-01-18 19:09:19 +00:00
2015-01-16 23:21:47 +00:00
#include "script_component.hpp"
2015-01-18 19:09:19 +00:00
2015-01-16 23:21:47 +00:00
private ["_object", "_return", "_val", "_category"];
_object = _this select 0;
_category = if (count _this > 1) then { _this select 1 } else { "" };
2015-01-17 12:54:44 +00:00
if (isnil QGVAR(OBJECT_VARIABLES_STORAGE)) exitwith {
2015-01-18 19:09:19 +00:00
[];
2015-01-16 23:21:47 +00:00
};
2015-01-17 12:54:44 +00:00
2015-01-16 23:21:47 +00:00
_return = [];
{
2015-01-18 19:09:19 +00:00
_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];
};
};
2015-01-16 23:21:47 +00:00
}foreach GVAR(OBJECT_VARIABLES_STORAGE);
_return