Accessing and traversing dictionaries in Max and Node
I'm at the beginner to intermediate level of programming in general and self taught. Max is amazing, and n4m is even better. Though, my favorite part of Max is the community, and how engaged everyone is.
So, I'm having trouble figuring out how to access a dictionary in node. I'm under the impression that max can create the dictionary (the patch does this part), and then node can simply access/reference it (the attached js file is an attempt at this). Please correct me if I'm wrong.
Not only that, I would like to extract parts of the dictionary to then manipulate it in ways like you would with paths or strings. Ultimately, I'd like to prepend the key with each array value in its array. Think of the key as a folder, and the array of values as files in that folder. There is more to this patch than what is linked. The final intention is to make a list of files in a folder and copy them to a user defined location. If you're curious, there is more on my github. Here .
Anyway, I have a dictionary in a patch that I'm attempting to manipulate. Do I need to reference DictList (top most dictionary) or MainList (one level into DictList)? Does it matter? Once node is accessing the dictionary, how do I traverse it?
I've been pretty reliant on community driven tutorials, videos, etc... up to this point, but am finding a lack of information concerning dictionaries and n4m. Or rather, information that's accessible to folks with intermediate experience.
Thanks!
I know Max isn't made for this type of task, but the patch works well. I'd like to learn how to utilize dictionaries with n4m.
I'm having trouble with the javascript syntax to access the dictionaries as well as the contents. Some pointers would be helpful in how to get to the dictionary data in node. I struggle with callbacks, promises, etc...
There is a difference between the usage of Dict() in the [js] object and the [node.script] object. Have a look here for some n4m examples: