diff options
author | mescalinum <mescalinum@users.sourceforge.net> | 2009-09-03 10:29:45 +0000 |
---|---|---|
committer | mescalinum <mescalinum@users.sourceforge.net> | 2009-09-03 10:29:45 +0000 |
commit | 2ce041bbd2fcb71a461ad3f10c8fc5afd1eef60c (patch) | |
tree | 418dc39f6273e26a5b81bc94d06b95f47849c424 | |
parent | 2e5f65d784c11ae62c2a317ba6ee98697cd7fff1 (diff) |
add default_arg proc, for writing nicer code
svn path=/trunk/externals/tclpd/; revision=12204
-rw-r--r-- | pdlib.tcl | 8 |
1 files changed, 8 insertions, 0 deletions
@@ -174,6 +174,14 @@ namespace eval ::pd { } } + proc default_arg {n assertion defval} { + if {$n < [uplevel "pd::args"]} { + return [uplevel "pd::arg $n $assertion"] + } else { + return $defval + } + } + # mechanism for uploading procs to gui interp, without the hassle of escaping [encoder] proc guiproc {name argz body} { # upload the decoder |