Jump to content

VEX - Variable override


samesami

Recommended Posts

How do i write function that can override it variables like the &prim and &uv in xyzdist.

float  xyzdist(<geometry>geometry, vector origin, int &prim, vector &uv) 

 

float myProcess(float &space; float sideBar ) 
{
    float space=1;
    space = 15 * sideBar;
}

 

Link to comment
Share on other sites

Since vex uses a call by reference way to call functions you do not need to do anything, just overwrite the values:

float bla(vector a; float b)
{
    a = set(1,2,3);
    b = 0.123;
    return 1.0;
}

vector tst = set(9,8,7);
float ff = .987;
bla(tst, ff);
printf("tst %f ff %f", tst, ff);

The printf should print the values overwritten in the bla() function.

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