#0 and/or -- arguments and gen~

yaniki's icon

Dear Friends

Do we have a section somewhere in the gen~ documentation that discusses using arguments that enable the creation of structures that allow the use of #0 and/or -- arguments to create local references, similarly to using the mentioned arguments for e.g. local send/receive connections?

Let's say I have an abstraction, in it a buffer~ object, which is also referenced by the code placed in gen~ (in the same abstraction). I use "--#0_something" in the name in buffer~ (to behave like a "locally" named object from both MaxMSP and M4L). Now how do we translate this into a "link" to buffer~ inside gen~.

I will be grateful for your suggestions and tips.

Graham Wakefield's icon

I think this was answered on the Discord, but posting here for visibility, as this is a frequent question:

You can't use "#0" etc directly in gen~, but you can easily work around it like this:

Let's say you have "buffer~ #0-foo" in the Max patch. Then in your gen~, just create "buffer foo" and use "peek foo" etc., and on the gen~ object set "gen @foo #0-foo". That will link the gen~ buffer "foo" to refer to the same memory as the Max buffer~ #0-foo.

You can also say gen~ @foo #0-foo too.

yaniki's icon

Dear Graham

Thank you very much!

Discord… hmmm…

👽'tW∆s ∆lienz👽's icon

Discord… hmmm…

haha, yes: 'forums' are for old people 👵