Jump to content

detailsmap usage


galagast

Recommended Posts

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.

Link to comment
Share on other sites

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 by MENOZ
Link to comment
Share on other sites

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 by f1480187
  • Like 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...