-
Notifications
You must be signed in to change notification settings - Fork 16
Description
this is more of a discussion since it's not a certain issue and probably there are different ways of handling this. therefore the rather generic title.
... the more i look into this, the more complex it seems to become for me. one rather simple use case might be:
- user wants to make his pd_lua object's receive name configurable through a message
this can be easily done with a mechanism like (omitting all checks here):
function test:in_1_receive(x)
self.recv:destruct()
self.recv = pd.Receive:new():register(self, x[1], "receive")
end
it becomes more challenging though if there are dollar arguments involved. a typical option would be a message like receive \$0-foo
to set the name to $0-foo
, where $0
gets internally expanded to the actual canvas id. this is the mechanism that's common for Pd's gui objects like toggle, sliders etc.
if i send receive \$0-bla
to the mechanism above, the dollar argument isn't expanded, which is probably expected, since $0
is obviously dynamic and shouldn't be forwarded in its expanded form, which would negate its purpose. but in that case, some kind of canvas_realizedollar()
1 function would be needed on the lua side, i assume?
when i use set_args()
with the received symbol, it ends up in the patch file as \\\$0-foo
- which means that the backslash gets escaped as well. might be expected, but prevents Pd from properly expanding the symbol on load.
attaching a pdlua object and patch for testing here2 - the updated arguments of [test_dollar] are obviously only visible on reload or cut/paste.