how to use the "push" function for arrays

   1117   2   0
User Avatar
Member
1004 posts
Joined: April 2017
Offline
Hi!

In a for-each sop I made an empty array in a detail wrangle:

i[]@reversed;

…and in the next point wrangle, I'm trying to append the iteration value coming from the metadata in an IF statement. I get an error and I don't know what I'm doing wrong:

int primID = prim(0, "id", 0);
int seed = chi("seed");

int reverse = int(fit01(rand(primID+seed), 0, 1.99999));

f@geou;



if(reverse == 1)
    {
    @geou = 1-@geou;
    push(i[]@reversed, detail(1, "iteration", 0));
    }

Attachments:
push_function.JPG (71.5 KB)

User Avatar
Member
2036 posts
Joined: Sept. 2015
Offline
You need to cast the detail function.

push(i[]@reversed, int(detail(1, "iteration", 0)));
User Avatar
Member
1004 posts
Joined: April 2017
Offline
AHHH!!!

I always get stuck on the smallest details (get it?!)

Thanks!

-Olivier
  • Quick Links