ACE3/addons/common/functions/fnc_dumpArray.sqf

43 lines
754 B
Plaintext
Raw Normal View History

2015-09-20 20:16:51 +00:00
/*
* Author: ?
* ?
*
* Arguments:
* 0: Array to be dumped <ARRAY>
* 1: Depth <NUMBER>
*
* Return Value:
* None
*
* Public: No
*/
2015-03-10 19:59:40 +00:00
#include "script_component.hpp"
2015-09-20 20:16:51 +00:00
params ["_var", "_depth"];
2015-03-10 19:59:40 +00:00
2015-09-20 20:16:51 +00:00
private "_pad";
2015-03-10 19:59:40 +00:00
_pad = "";
2015-05-14 18:06:06 +00:00
2015-03-10 19:59:40 +00:00
for "_i" from 0 to _depth do {
_pad = _pad + toString [9];
2015-03-10 19:59:40 +00:00
};
2015-05-14 18:06:06 +00:00
2015-03-10 19:59:40 +00:00
_depth = _depth + 1;
2015-05-14 18:06:06 +00:00
if (IS_ARRAY(_var)) then {
2015-09-20 22:34:04 +00:00
if (_var isEqualTo []) then {
diag_log text format["%1[],", _pad];
} else {
diag_log text format["%1[", _pad];
2015-09-20 20:16:51 +00:00
{
[_x, _depth] call FUNC(dumpArray);
2015-09-20 20:16:51 +00:00
false
} count _var;
diag_log text format["%1],", _pad];
};
2015-03-10 19:59:40 +00:00
} else {
diag_log text format["%1%2", _pad, [_var] call FUNC(formatVar)];
2015-03-10 19:59:40 +00:00
};