Code: Select all
set temp(duration) [duration [expr [clock seconds]-[lindex $temp(entry) 1]]]
Guess: the [lindex $temp(entry) 1] doesn't produce anything.caesar wrote:I'm keep getting this error: "Tcl error [next:list]: syntax error in expression "1042538818-": premature end of expression". Can someone point me the mistake so to fix the problem?
[snip]
set temp(duration) [duration [expr [clock seconds]-[lindex $temp(entry) 1]]]
Code: Select all
foreach temp(entry) $temp(list) {
set temp(duration) [duration [expr [clock seconds]-[lindex $temp(entry) 1]]]
lappend temp(post) "[lindex $temp(entry) 0] ($temp(duration))"
}
Not true.Papillon wrote:you are doing a loop on a list "$temp(list)", when pulling out one item from it, the item is beeing handeled as a string, you have to split the $temp(entry) before pulling out a elementCode: Select all
foreach temp(entry) $temp(list) { set temp(duration) [duration [expr [clock seconds]-[lindex $temp(entry) 1]]] lappend temp(post) "[lindex $temp(entry) 0] ($temp(duration))" }
Code: Select all
a b c d e f g
Code: Select all
set list [list a b c d e f g]
Code: Select all
set list "a b c d e f g"
Code: Select all
set list [list a b c "d{" e f g]
EQUALS
a b c {d{} e f g
Code: Select all
set list [list a b c [list d e [list f g h] i] j]
EQUALS
a b c {d e {f g h} i} j
Code: Select all
foreach entry $list {
puts stdout "> $entry"
}
Code: Select all
> a
> b
> c
> d e {f g h} i
> j
Code: Select all
set Suser [lindex $Lusers 0]
set Luser [list $Spermissions [string toupper $Suser]]
Code: Select all
set temp(duration) [expr [clock seconds] - [lindex [lindex $temp(list) 0] 1]]
Caesar, there are 2 instances in your script where the "temp(duration)" is computed just after you have created the list by using "set temp(list) [next:cmds get_list $chan]".caesar wrote:Oh and..
A1: yes and on other commands that use "duration".
A2: It seems to work fine, I'm getting the error only when I use one of the commands that use "duration".
Code: Select all
set temp(list) [next:cmds get_list $chan]
foreach element $temp(list) {
putlog "Element on list: $element"
}