My goal is to add commands to a loop that is already running , I know how to do it with global variables like this :
proc myLoop {} {
global cmd1 cmd2 cmd3
if {$cmd1} {
# do something...
}
if {$cmd2} {
# do something...
}
# ...
after 1000 myLoop
}
set cmd1 0 ; set cmd2 1
myLoop
I’d like to do this on the fly :
addCmdInLoop [list myCmd $arg1 $arg2] . I had thought to rename my myLoop every time and replace it but I don’t know if this is possible or efficient.