runtime icon indicating copy to clipboard operation
runtime copied to clipboard

Make Pre- and Post- increment/decrement operators work on all types

Open NeutraleNull opened this issue 3 years ago • 0 comments

Describe the bug

Lets say i've got this little array here: example = [ [0,1], [0, 1, 2] ];

Now i want to increase the second value in the first array by one by doing

example[0][1] = ++example[0][1];

However the output sqf code is:

   example = [[0, 1], [0, 1, 2]];
   example = (example + 1);
   example select 0 set [1, example select 0 select 1];

I tries to first increment example and thereafter assign the value to array. Doing a post increment won't work at all in this context.

I guess this is a really specific usecase and i won't mind not fix it. In the end it would generate the same code as i would if i had written:

let temp = example[0][1];
temp++;
example[0][1] = temp;

NeutraleNull avatar Mar 08 '21 11:03 NeutraleNull