When $1 exists and has the value 0: [symbol $1-foo] = 0-foo
When there is no $1: [symbol $1-foo] = \$1-foo
Therefore not only can you tell if an argument was set to 0 in Pd vanilla, but you can fetch the entire list of args by counting up from $1 until $n-foo = \$n-foo.
There are subpatches and abstractions on this list that use that method to fetch the args in Pd Vanilla.
There is probably also an external for every developer who has needed this functionality in their own patches, most of which are available in Pd-extended.
-Jonathan
From: Hans-Christoph Steiner hans@at.or.at To: Cyrille Henry ch@chnry.net Cc: pd-list@iem.at Sent: Thursday, October 11, 2012 12:26 PM Subject: Re: [PD] creation arg, distinction between 0 and no arg, WAS Re: Splitting Objects
Interesting. But its not really useable with dollar args, unfortunately, where $@ is.
[default_arg $1] won't tell you whether $1 was set or not since it'll show up as zero to defulat-arg.pd
.hc
On 09/25/2012 10:08 AM, Cyrille Henry wrote:
hello,
a dirty hack allow distinction between no argument and a 0 float arg. see attachment. cheers c
Le 25/09/2012 15:45, Patrice Colet a écrit :
De: "Patrice Colet" colet.patrice@free.fr
De: "Funs Seelen" funsseelen@gmail.com
Speaking about creation arguments: if none are given for abstractions the default value is always "0" (at least I never figured out a way to give another default value *). For C-objects it is possible to use any float value as default.
[loadbang] | [$1] | [sel 0] | [my default value(
indeed it doesn't seem possible to set a default value and keep 0 as another value
Pd-list@iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list
Pd-list@iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list
Pd-list@iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list