90okm Posted January 25, 2017 Share Posted January 25, 2017 (edited) Hi ! trying to work with vex snippets and faced the problem ! I've created an integer array attribute on primitives and want to fill it with some values in attrib wrangle but i always get the error message of "Ambiguous call to array index operator ''. Candidates are: 'float vector4[int]', 'float vector2[int]', 'float vector[int]'" being declared within wrangle node the construction like this i[]@arr = {}; @arr[0]=@primnum-21; works fine wrangle_error.hip Edited January 25, 2017 by 90okm Quote Link to comment Share on other sites More sharing options...
fsimerey Posted January 25, 2017 Share Posted January 25, 2017 (edited) Try this in wrangle Primitive node: i[]@arr = {-1,0,1}; // Create an array with values i@arr[1] = @primnum; // Set primnum in array[1] This create and set value of an integer array. Edited January 25, 2017 by fsimerey Quote Link to comment Share on other sites More sharing options...
dimovfx Posted January 25, 2017 Share Posted January 25, 2017 i[]@arr[0] = 21; this seems to work Quote Link to comment Share on other sites More sharing options...
90okm Posted January 26, 2017 Author Share Posted January 26, 2017 14 hours ago, sasho78 said: i[]@arr[0] = 21; this seems to work Yes it works, but it looks like declaring new attribute....that's why i was confused. thanks Quote Link to comment Share on other sites More sharing options...
dimovfx Posted January 26, 2017 Share Posted January 26, 2017 Might be wrong, but if the attribute exists then it's just a statement what type of attribute you are trying to access, otherwise it has to guess what type of attribute is and it seems that it's not very good at it It's not a bad practice to state the type of the attribute every time you want to work with it. Quote Link to comment Share on other sites More sharing options...
f1480187 Posted January 26, 2017 Share Posted January 26, 2017 Here the list of known attributes which does not require type specified. As stated, all others will be assumed as floats. But you need to write type only once, later you may omit type: v@test = {1, 1, 1}; // Type need to be specified once. @test = 0; // Still a vector assigment, will be set as {0, 0, 0}. You also can declare attributes by writing full type name, in that case value will be used as default: vector @test = {1, 2, 3}; Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.