Clayman 20 Posted March 24, 2017 I have a bunch of groups, which might or might not have been created so far (depending on the path the player has chosen). At some point I want to delete all groups that have been created so far. I've tried an isNil check for an array of all groupnames, which works well when all groups have been created. But if any of those groups has not been created, it throws up an undefined variable error. Different variants I have tried, so far to no avail: {if (!isNil _x) then {deleteGroup _x}} forEach [grp1, grp2, grp3]; // Undefined Variable {if (!isNil "_x") then {deleteGroup _x}} forEach [grp1, grp2, grp3]; // Undefined Variable {if (!isNil {_x}) then {deleteGroup _x}} forEach [grp1, grp2, grp3]; // Undefined Variable {if (!isNil str (_x)) then {deleteGroup _x}} forEach [grp1, grp2, grp3]; // Undefined Variable {if (!isNil _x) then {deleteGroup _x}} forEach ["grp1", "grp2", "grp3"]; // deleteGroup: Type String, expected Group Of course I could check each group individually, or add all created groups to an array and use this instead (which I'll probably do anyway). But I'd like to understand why this variant does not work. Anyone can enlighten me?^^ Share this post Link to post Share on other sites
killzone_kid 1329 Posted March 25, 2017 { deleteGroup (missionNamespace getVariable [_x, grpNull]); } forEach ["grp1", "grp2", "grp3"]; Share this post Link to post Share on other sites
Clayman 20 Posted March 25, 2017 That did the trick, thanks. Although I don't quite understand what I am doing here. Is it all about different data types? getVariable using a string as argument, while missionNamespace returning the actual group? Share this post Link to post Share on other sites
killzone_kid 1329 Posted March 25, 2017 the groups you name in editor are stored in missionNamespace variables with the same name Share this post Link to post Share on other sites