View Full Version : How to set conditional default for an input clip ?
WorBry
25th April 2010, 01:17
Quick question.
Say I am writing a function with two-clip input - clp1 and clp2. If clp2 is not defined by the user, I want the function to default to clp1.
Tried clp2 = default(clp2, clp1), but that gets rejected.
What is the correct way to set this?
WorBry
25th April 2010, 03:01
I guess I was considering the equivalent of:
a = ColorBars()
b = a.Greyscale()
the_test(a,b)
function the_test(clip clp1, clip clp2)
{
clp2 = default(clp2, clp1)
return StackHorizontal(clp1, clp2)
}
Works, as expected, but.....
a = ColorBars()
b = a.Greyscale()
the_test(a)
function the_test(clip clp1, clip clp2)
{
clp2 = default(clp2, clp1)
return StackHorizontal(clp1, clp2)
}
......throws 'invalid argument'.
Aha, need to add quotation marks for Clp2
a = ColorBars()
b = a.Greyscale()
the_test(a)
function the_test(clip clp1, clip "clp2")
{
clp2 = default(clp2, clp1)
return StackHorizontal(clp1, clp2)
}
That works.
Thanks.
WorBry
25th April 2010, 20:12
Strange, once again, Stephen R Savage's reply to my query, which was very helpful, was there one minute and gone the next. Kind of looks like I already knew the answer to the question I asked.
I know people have commented on this before, but if someone deletes a post, it would be helpful to at least leave some indication that there was a post there, even if the reason for deleting is not given and/or the user's name is not stated.
There are lots of things I have posted that I cringe to look at now, but my feeling is 'what I have written I have written'; if people post they should commit to it. Correct stuff sure, as an edit, but don't make other people look foolish.
And in this case, I cant imagine why the user deleted his post, as it was very helpful.
Wilbert
25th April 2010, 20:49
@Stephen R. Savage,
Your PM is turned off. Is there a reason why you delete half of your posts? (I restored your post in this thread for readability reasons.)
WorBry
25th April 2010, 22:05
Thanks Wilbert.
vBulletin® v3.8.11, Copyright ©2000-2025, vBulletin Solutions Inc.