/* * 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 * 1: variableName * 2: value * 3: Global * * Return Value: * None * * Public: No */ #include "script_component.hpp" params ["_list", "_variable", "_setting", "_global"]; if (typeName _list == "STRING") then { private ["_splittedList", "_nilCheckPassedList"]; _splittedList = [_list, ","] call BIS_fnc_splitString; _nilCheckPassedList = ""; { _x = [_x] call FUNC(stringRemoveWhiteSpace); if !(isNil _x) then { if (_nilCheckPassedList == "") then { _nilCheckPassedList = _x; } else { _nilCheckPassedList = _nilCheckPassedList + ","+ _x; }; }; false } count _splittedList; _list = [] call compile format["[%1]",_nilCheckPassedList]; }; { if (!isNil "_x") then { if (typeName _x == typeName objNull) then { if (local _x) then { _x setvariable [_variable, _setting, _global]; }; }; }; false } count _list; true