Mercurial > hg > egg-tcls
changeset 611:6f1d26814cc9
utillib: Add helper function utl_arg_get for getting arguments from a given list.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Wed, 10 Feb 2021 11:07:41 +0200 |
parents | a5c929a473ac |
children | c340683d6c13 |
files | utillib.tcl |
diffstat | 1 files changed, 15 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/utillib.tcl Tue Feb 09 12:53:04 2021 +0200 +++ b/utillib.tcl Wed Feb 10 11:07:41 2021 +0200 @@ -139,6 +139,21 @@ } +proc utl_arg_get {uarglist uindex uarg uautoinc} { + upvar $uindex rindex + upvar $uarg rarg + + if {[llength $uarglist] < $rindex + 1} { + return 0 + } + + set rarg [lindex $uarglist $rindex] + set rindex [expr $rindex + $uautoinc] + + return 1 +} + + ### ### SQL database handling ###