Log in

View Full Version : null arguments in scripts?


Mug Funky
6th January 2004, 14:35
hiyah. i'm here to ask a newbie question (OMG!)...

when writing a function for avisynth that has arguments, how should i handle it if no argument is given?

for instance, i've included an optional post-processing in my semi-smart bob function, and i want it to default to post=true if no argument is given (it's more user friendly).

what would the syntax be for that?

example:

function FunkyBob(clip c, bool "post") {

post = (post == [null]) ? true

[insert the rest of script here :)]

what should i put where i currently have [null]?

Wilbert
6th January 2004, 15:20
post = default(post,true)

Mug Funky
6th January 2004, 15:31
nice. thanks. :):)

stickboy
6th January 2004, 22:06
For completeness, there's also the defined function.
var = default(var, val)is shorthand for
var = defined(var) ? var : val

Mug Funky
7th January 2004, 12:29
coolio. i must have used the wrong search words to not find that myself. hehehe.