Jump to content

How to return two arrays in VEX


Recommended Posts

Use routine-style. For some reason, we cannot define functions returning arrays in Wrangle/Snippet nodes (more generally, array functions defined inside other functions), and we have to use this style for setting single array too.

 

Example for Point Wrangle:

void two_arrays(float a1[]; vector a2[])
{
    a1 = array(1, 2, 3);
    a2 = array({1,2,3}, {4,5,6}, {7,8,9});
}

two_arrays(f[]@array_one, v[]@array_two);

BTW this called side effects.

  • Like 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...