group.queryTree question

I’m trying to get a list of the nodes in a group using .queryTree. The man page gives a good example of it’s use, however I cannot get it to behave the way it’s described.

// now query my tree and post a graph of it (duplicates dumpTree)
// msg format is ['/g_querytree.reply', node1-ID, numChildren, defName, child1-ID, numChildren, ...]
(
g.queryTree({|msg|
   var i = 1, tabs = 0, dumpFunc;
   ("NODE TREE Group" + msg[1]).postln;
   if(msg[2] > 0, {
       dumpFunc = {|numChildren|
           tabs = tabs + 1;
           numChildren.do({
               i = i + 3;
               tabs.do({ "   ".post });
               msg[i].post;
               (" " ++ msg[i + 2]).postln;
               if(msg[i + 1] > 0, { dumpFunc.value(msg[i + 1]) });
           });
           tabs = tabs - 1;
       };
       dumpFunc.value(msg[2]);
   });
});
)

This is from the man page. It shows .queryTree accepting a function. I cannot get this to work.
What am I doing wrong?

works over here! (you have to set interpreter variable g to your group first though!)

g=Group.new;
Synth(\default,target:g);
g.queryTree etc etc

From the docs, I expect a function to be executed:

g = Group.new;
Synth(\default,target:g);
g.queryTree ({|msg|
	"test".postln;
});

Should output:

test

but I get:

-> Group(1124)
NODE TREE Group 1124
  1125 default

The example from the man page simply does what .queryTree does by default.

ahh I see - looking at the source it looks like the method no longer takes an argument ( |action| is commented out ) - docs are out of date it seems… you could hack together a different OSCFunc using the method as a model perhaps…

Thanks for looking into this. The man page example creates an array of the synths as they’re added to the group. I guess this is how the client keeps track of what’s in the group. I’m starting to understand the client server model… I think.

I might try the OSCFunc as a learning exercise.