2015-08-15 13:49:41 +00:00
|
|
|
/*
|
|
|
|
* Author: Glowbal
|
|
|
|
* Loops through a string and filters out object names/variables to assign a value for given variable.
|
|
|
|
* Used by moduleAssign* within various parts of the ACE3 project.
|
|
|
|
*
|
|
|
|
* Arguments:
|
|
|
|
* 0: list <STRING>
|
|
|
|
* 1: variableName <STRING>
|
|
|
|
* 2: value <ANY>
|
|
|
|
* 3: Global <BOOL>
|
|
|
|
*
|
|
|
|
* Return Value:
|
|
|
|
* None <NIL>
|
|
|
|
*
|
|
|
|
* Public: No
|
|
|
|
*/
|
|
|
|
#include "script_component.hpp"
|
|
|
|
|
|
|
|
params ["_list", "_variable", "_setting", "_global"];
|
|
|
|
|
|
|
|
if (typeName _list == "STRING") then {
|
2015-09-20 20:29:38 +00:00
|
|
|
private ["_splittedList", "_nilCheckPassedList"];
|
|
|
|
|
2015-08-15 13:49:41 +00:00
|
|
|
_splittedList = [_list, ","] call BIS_fnc_splitString;
|
|
|
|
_nilCheckPassedList = "";
|
2015-09-20 20:29:38 +00:00
|
|
|
|
2015-08-15 13:49:41 +00:00
|
|
|
{
|
|
|
|
_x = [_x] call FUNC(stringRemoveWhiteSpace);
|
2015-09-20 20:29:38 +00:00
|
|
|
if !(isNil _x) then {
|
2015-08-15 13:49:41 +00:00
|
|
|
if (_nilCheckPassedList == "") then {
|
|
|
|
_nilCheckPassedList = _x;
|
|
|
|
} else {
|
|
|
|
_nilCheckPassedList = _nilCheckPassedList + ","+ _x;
|
|
|
|
};
|
|
|
|
};
|
2015-09-20 20:29:38 +00:00
|
|
|
false
|
|
|
|
} count _splittedList;
|
2015-08-15 13:49:41 +00:00
|
|
|
|
|
|
|
_list = [] call compile format["[%1]",_nilCheckPassedList];
|
|
|
|
};
|
|
|
|
|
|
|
|
{
|
2015-09-20 20:29:38 +00:00
|
|
|
if (!isNil "_x") then {
|
2015-08-15 13:49:41 +00:00
|
|
|
if (typeName _x == typeName objNull) then {
|
|
|
|
if (local _x) then {
|
|
|
|
_x setvariable [_variable, _setting, _global];
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
2015-09-20 20:29:38 +00:00
|
|
|
false
|
|
|
|
} count _list;
|
2015-08-15 13:49:41 +00:00
|
|
|
|
|
|
|
true
|