Why is getvalueof() called multiple times for each call to notifyclients()?

Mar 9, 2012 at 1:46pm

Why is getvalueof() called multiple times for each call to notifyclients()?

I’ve got a js object that holds an array and defines getvalueof() and setvalueof() so I can persist to a pattr.

It works. No problem, but I noticed that when I call notifyclients() my getvalueof() method is called multiple times. I’m not sure why.

inlets = 1;
outlets = 1;

var saved_data = [];

function list(a) {
saved_data.push( a );
outlet(0, a);

function showall() {
for (var i in saved_data) {
post(saved_data[i] + “n”);

function clear() {
saved_data = [];

function getvalueof() {
return saved_data

function setvalueof() {
restored_data = arrayfromargs(arguments);
saved_data = restored_data;

Here’s a simple patch illustrating the behavior:

– Pasted Max Patch, click to expand. –

It’s really bugging me. I can’t tell if this is normal of if I’m missing some poor patching I did somewhere.

When I click on one of the numeric messages to be stored, getvalueof() is called 3 times?!

I must be doing something wrong. Opinions?

Mar 10, 2012 at 10:25pm

I don’t think you’re doing anything wrong, I think that’s just the way it is. I’d love to know why, though.

Mar 11, 2012 at 6:19am


AFAIK it does more or less the same with C externals ; could be that more than one observer need to know the new value ; storage process, attributes refreshed, UI …

My 2 cents.

Mar 12, 2012 at 1:17am

Not exactly solving the mystery, but I’m glad I’m not the only one experiencing it. Thanks for the responses!


You must be logged in to reply to this topic.