Jump to content

vex array splat/unpack operator for function arguments?


benthejack

Recommended Posts

I'm new to vex and was wondering if there is a splat operator to unpack arrays into function arguments? (like javascript's ... or rubys *)

The reason I'm asking is I have a wrangle that I want to take an unknown number of points and put their position into the cspline function.

In the docs we have vector  cspline(float t, vector val1, ...)

If it was Javascript I'd do something like cspline(t, ...array_of_parameters) to unpack my array into that list of parameters, is it possible to do something similar in vex?

If it's not possible how can you get an unknown number of parameters into a function that takes an unknown number of parameters?

 

Cheers

Ben

Link to comment
Share on other sites

Hmm well it looks like I just found another version of the function that takes arrays as arguments. But the main question still stands, is it possible to unpack an array into function arguments? 

vector  spline(string basis, float sample_pos, vector values[], ...)

 

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...