Jump to content

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

 

Share this post


Link to post
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} };
}

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×