Jump to content
Sign in to follow this  
combat-agent

Array within an array

Recommended Posts

Im trying to delete an array within the array, for some reason its not working. Heres what I got.

init.sqs

CurrentMissionselection=0

Mission= [[Missionnum,"killgroup",5000,7,20]];

sctipt

_1 = CurrentMissionselection

mission = mission-[mission select _1]

Ill have to take a look again, but it appears it doesnt do anything when I do that. One instance, it added another pair of brackets. Where am i going wrong here?

Share this post


Link to post
Share on other sites

Quoting from BI Wiki:

Nested arrays cannot be substracted - i.e. the following does NOT work:

_a1 = [[1,1],[2,2],[3,3]];
_a2 = [[2,2]];
_a3 = _a1 - _a2; // will still return [[1,1],[2,2],[3,3]]

Workaround: You can remove nested arrays by first replacing them with a non array variable.

Example:

_array = [["first","hello1"],["second","hello2"],["third","hello3"]];
_array set [1,-1];
_array = _array - [-1];
// _array will now contain: [["first","hello1"],["third","hello3"]]

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×