Jump to content

Array Function VEX


MJNorris

Recommended Posts

Hi there,

I'm playing around with creating some custom VEX functions and came across something a bit odd that I just can't seem to get working.

If I want to create a custom function that returns an array, say a vector array I will need to declare the return type at the beginning, according to the docs the following should work

// A function which returns an array of vectors
vector[] rgb_array()
{
...
};    

However if I run this in a wrangle I get a syntax error on line1.

Is this a bug? Or am I declaring my function type incorrectly?

 

Thanks in advance

m

 

Link to comment
Share on other sites

Okay, I actually got it working but those who have a similar issue I needed to use the 'funtion' function as the VEX compiler seems to be getting confused

 

so ....................

 

//doing an explicit function declaration seems to stop VEX getting muddled up

function vector[] rgb_array()
{
    return { {1, 0, 0}, {0, 1, 0}, {0, 0, 1} };
}

 

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