galagast Posted October 27, 2016 Share Posted October 27, 2016 Hi, anyone knows the proper usage of this expression function? Quote detailsmap Returns a string from a list of strings in a detail attribute. detailsmap(surface_node , attribute , index ) This function will return the indexth unique string bound to the given detail attribute. Use detailsnummap to find the total number of unique strings. Note that the exact order of the strings should not be relied upon. The indexes start with 0 and go to detailsnummap()-1. What are "list" of strings? I tried creating an array, and a bunch of numbered attributes for the detail wrangle.. // Array s[]@arr = array("apple", "banana", "carrot", "durian"); // List? s@txt1 = "apple"; s@txt2 = "banana"; s@txt3 = "carrot"; s@txt4 = "durian"; Then I tried accessing those using this: detailsmap(0, "arr", 1) //or detailsmap(0, "txt", 2) None seems to return the string that I'm querying. Quote Link to comment Share on other sites More sharing options...
f1480187 Posted October 29, 2016 Share Posted October 29, 2016 It's for varmap use only, I think. You can create and use it in a limited way by using some hacks. string_vector_hack.hipnc Quote Link to comment Share on other sites More sharing options...
galagast Posted October 31, 2016 Author Share Posted October 31, 2016 Cool! Learned something new This is the first time I've seen the attributes being juggled around like that. Thank you F1. Quote Link to comment Share on other sites More sharing options...
MENOZ Posted November 1, 2016 Share Posted November 1, 2016 (edited) I didn't know that you could use hscript inside vex... s@_scomp = '`pointsmap(opinputpath(".", 0), "_svec", 2)`'; I always promoted a parameter and wrote the expression in there. is there any performance difference? thanks! EDIT so this works only with strings? Is this documented somewhere? Edited November 1, 2016 by MENOZ Quote Link to comment Share on other sites More sharing options...
f1480187 Posted November 4, 2016 Share Posted November 4, 2016 (edited) You couldn't use HScript inside VEX, but the code field is a text parameter, where you can use HScript or Python. It will be evaluated before passing to VEX compiler (VCC). You could evaluate expression for current frame by pressing MMB on parameter's name. It will work with everything, not just strings. I used set of single quotes around backticks to enclose inner expression where double quotes was used. Which isn't even necessary in this case, since backticks expression will be evaluated before wrong string termination may occur, but it simply look cleaner. float_var = `some expression`; // How the Code parameter will look. float_var = 42; // What will be sent to VCC. string_var = "`some expression`"; // How the Code parameter will look. string_var = "42"; // What will be sent to VCC. Edited November 4, 2016 by f1480187 1 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.