我有两个proc :从MAIN调用另一个proc Glob。$Allforces是一个列表列表。
proc ::MAIN {} {
# something
::Glob $AllForces
}
proc ::Glob {Input} {
upvar $Input AllForces
# do something
}我得到了"No such variable“作为我尝试upvar的错误。所以我试着:
upvar $InputMPCForces ::MAIN::AllForces然后我得到:"upvar won't create namespace variable that refers to procedure variable“
如何通过引用从Glob中的MAIN访问AllForces?
发布于 2013-07-05 23:03:18
你需要这样调用你的proc:
::Glob AllForces也就是说,传递的是变量的名称,而不是它的值。
然后,在该过程中,upvar命令将接受其名称为本地变量input的值的变量,并使其在本地作为AllForces可用
https://stackoverflow.com/questions/17491219
复制相似问题