[PD] Further questions on struct and the external api

João Pais jmmmpais at gmail.com
Wed Sep 15 19:54:20 CEST 2021

> I’m discovering the superb world of struct (with the 3 recommended tutorials, all of which very biased towards the graphic angle

at least there is a visible reward for all the effort it takes to work 
with data-s

> but I found ways around) and my new favourite friend is [text] for that reason :)
> 2 questions:
> - in the attached patch, I needed to create a dummy entry to my ‘test-item’ struct to be able to dynamically add entries infusing [append] - do I understand right?

what you mean with dummy? [append] needs at least one float to be 
declared, if that's what you mean (unless someone implements a bang 
method to add a scalar without variables). the "key" variable can be 
removed from the template, if you wish. But the scalar created isn't a 
dummy, but the array itself.

Btw you can use [append test-item] with no further arguments. But there 
will be an error message "pd-test-item.: no such field" every time it 
receives an input, although it does create the scalar. You can even 
remove all variables and leave only [struct test-item array value 
float], if you're into consoles full or red letters. I guess so far no 
one predicted that a scalar could have no variables at all.

> - it seems that I would be able to find workarounds the fact we cannot search my dataset by making an entry that would hold my keys at the top but that is cumbersome so I’m now making friends with the fantastic [text] object… the question I now have is for people developing externals: is it possible to access and write to struct and/or arrays from an external developed through the API? I didn’t find examples doing so nor any reference to text_buf in the API so I wonder if anyone has any pointers on that. Worse case I can use a message to dump a list and then [text fromlist] but that would be limited by the maxlength of the said list which was a problem in Max (hence us going the extra mile of supporting native dicts there)
> Thanks all for your help.
> p
> _______________________________________________
> Pd-list at lists.iem.at mailing list
> UNSUBSCRIBE and account-management -> https://lists.puredata.info/listinfo/pd-list

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puredata.info/pipermail/pd-list/attachments/20210915/97328feb/attachment.htm>

More information about the Pd-list mailing list