Help with using $1 in messages

Aug 12, 2011 at 2:36am

Help with using $1 in messages

I’d like test$1 to work the same way that $1test does. Is this possible somehow? See the attached code.

`

– Pasted Max Patch, click to expand. –
#58437
Aug 12, 2011 at 3:21am

The following works. (But in situations such as this you can also question whether the exigencies you have created for yourself are really strictly necessary. That is, could you change your requirements so that 2test would be satisfactory?)

– Pasted Max Patch, click to expand. –
#210012
Aug 12, 2011 at 3:24am

Ah thank you. Yes I will investigate just changing the format needed, I was just curious as to if there was a to format it or something so that it knew what I was doing, like a test”$1″ or something like that. Thank you for your solution!

#210013
Aug 12, 2011 at 8:41pm

[sprintf] or [combine] or [regexp] are needed to attach variables *into* symbols, as part of the symbol. Without using them they’ll typically turn into “test 2″, the way messages deal with $1 etc. This is also important when using #1 etc. as arguments in abstractions, or if you want to use [forward] with different symbols:

– Pasted Max Patch, click to expand. –
#210014

You must be logged in to reply to this topic.