Search - User list
Full Version: vex - vector set()
Root » Technical Discussion » vex - vector set()
metaclay2
Hi , what is the difference between these 2 vector assignments :
vector myVect = set(1,2,3);
vector myVect = {1,2,3};

Thanks
matthias_k
In this case nothing
but:

float foo = 0.5;

vector myVect = set(1,foo ,3); // will work
vector myVect = {1,foo ,3}; // errors out
metaclay2
matthias_k
In this case nothing
but:

float foo = 0.5;

vector myVect = set(1,foo ,3); // will work
vector myVect = {1,foo ,3}; // errors out

Yes, that's what confused me. The “{}” can't take variable … is it design like that or is it a bug ?
BabaJ
It's neither by design or a bug.

Perhaps you could say it is ‘by design’ indirectly;

The curly braces are not a “function” - they are simply part of a syntax structure that we can use in certain contexts, in this case along with the combination of = , and ; characters that allow us to assign values to ‘myVec’.

There's nothing to tell the compiler what foo is or how it should be handled, to do that, we need a simple function;

like say - the set() function, that can handle what foo is.

All you more knowledgeable people out there - please do chime and correct me or rephrase/add to what I've said if wrong.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Powered by DjangoBB