[PD] creation arg, distinction between 0 and no arg, WAS Re: Splitting Objects

Cyrille Henry ch at chnry.net
Thu Oct 11 18:49:55 CEST 2012


hello

Le 11/10/2012 18:26, Hans-Christoph Steiner a écrit :
> 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

well, yes, but one can arg that in this example ([default_arg $1]) 1 argument ($1) is provided to default_arg.
so 0 is the right answer.

This patch was just a proof of concept. you have to use this trick in a sub-patch, not as an abstraction.
anyway, i know that this is not a generic solution to this problem.

cheers
c

>
> .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 at free.fr>
>>>>> De: "Funs Seelen" <funsseelen at 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 at iem.at mailing list
>>> UNSUBSCRIBE and account-management ->
>>> http://lists.puredata.info/listinfo/pd-list
>>>
>>
>>
>> _______________________________________________
>> Pd-list at iem.at mailing list
>> UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list
>>
>
>



More information about the Pd-list mailing list