Possible to get Dict() sub dictionary reference (not copy) in JS?

    Javascriptbugs/issues

    tyler mazaika
    Feb 26 2023 | 10:43 pm
    In Max, you can pass "get <foo>" to a [dict] where the value of <foo> is a dictionary. Output (2nd outlet) is:
    <foo> dictionary u12345678
    u12345678 is the name of the sub dictionary which can be very usefully used as the @name attribute of a dict.pack to modify the contents directly in the parent dict.
    In JS, if you call mydict.get("<foo>") you are returned a Dict object, but this returned Dict does not have the same name when you query it's name property.
    So, in JS is it possible to get the reference to the child dictionary rather than a Dict object?
    FWIW I'm trying to do some scripted creation of [dict.pack] objects and set their @name, which is why I would like for this to work...

    • tyler mazaika's icon
      tyler mazaika
      Apr 25 2023 | 2:23 pm
      @cycling74 folks... does anybody know if this is possible?
      The workaround involves going from JS into max messages to a [dict] object and back to JS. It's cumbersome.
      Share
    • Trevor being Trevor's icon
      Trevor being Trevor's icon
      Trevor being Trevor
      Apr 26 2023 | 3:16 pm
      Not sure if this helps, but in the past I have saved the child dictionary to a separate variable, made changes and then saved it back into the parent dictionary.
    • tyler mazaika's icon
      tyler mazaika's icon
      tyler mazaika
      May 11 2023 | 5:35 pm
      Yeah, that's inefficient and precludes the use of the same child dictionary being modified from multiple places in the UI, among other things.