ACE3/addons/common/functions/fnc_getAllDefinedSetVariables.sqf

41 lines
857 B
Plaintext
Raw Normal View History

2015-09-20 21:40:51 +00:00
/*
* Author: Glowbal
* Returns an 2d array of all variables that have been set on the object
2015-01-16 23:21:47 +00:00
*
2015-09-20 21:40:51 +00:00
* Arguments:
* 0: Unit <OBJECT>
* 1: Limiting Category (default: "") <STRING>
*
* Return Value:
* Variable Data <ARRAY>
* 0: Name <STRING>
* 1: typeName <STRING>
* 2: value <ANY>
* 3: publicFlag <BOOL>
* 4: peristentFlag <BOOL>
*
* Public: Yes
2015-01-16 23:21:47 +00:00
*/
#include "script_component.hpp"
2015-01-18 19:09:19 +00:00
2015-09-20 21:40:51 +00:00
params ["_object", ["_category", ""]];
if (isNil QGVAR(OBJECT_VARIABLES_STORAGE)) exitwith {[]};
2015-01-16 23:21:47 +00:00
2015-09-20 21:40:51 +00:00
private ["_return", "_val"];
2015-01-17 12:54:44 +00:00
2015-01-16 23:21:47 +00:00
_return = [];
2015-09-20 21:40:51 +00:00
2015-01-16 23:21:47 +00:00
{
2015-01-18 19:09:19 +00:00
_val = _object getvariable (_x select 0);
2015-09-20 21:40:51 +00:00
if (!isNil "_val") then {
2015-01-18 19:09:19 +00:00
if (_category == "" || _category == _x select 3) then {
2015-09-20 21:40:51 +00:00
_return pushBack [_x select 0, typeName _val, _val, _x select 2, _x select 5];
2015-01-18 19:09:19 +00:00
};
};
2015-09-20 21:40:51 +00:00
false
} count GVAR(OBJECT_VARIABLES_STORAGE);
_return