Forums > Dev

symbols bound to messages VS symbols bound to attributes

December 2, 2011 | 1:30 pm

Hi there,

I have created a NOBOX class with methods and attributes defined.
I created many instances of this class and I’ve filled a t_linklist with them.

Now, the linklist API has two handy functions: linklist_methodindex() and linklist_methodall(). I use these two functions to send messages to the instances of my NOBOX class and trigger methods bound to those messages. Everything works great.

Now, I would like to send a message that is not bound to a method, but that corresponds to the name of an attribute defined inside my NOBOX class. The idea is to be able to change the value of the attribute with linklist_methodindex() and linklist_methodall().

If I had a BOX class instantiated in a patcher and sent a symbol to it, the same symbol could be interpreted as a message or as an attribute, depending of what is defined how inside the class.

So I thought the same would go for the linked list case but it’s not so.
Now I would like to avoid wrapping each attribute defined in my NOBOX class into a method so that I could just call it using the linklist API.

Is there an easier and less cumbersome way to achieve the same?

Many thanks.

- Luigi


December 3, 2011 | 1:59 pm

Hey Luigi,

You can probably achieve what you want with a combination of linklist_funall() and object_attr_setlong/float/andwhatnot().

ej


Viewing 2 posts - 1 through 2 (of 2 total)