Skip to content

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

@NeutraleNull

Description

@NeutraleNull

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;

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions