Name

upeval — Evaluate script in next stack frame up.

Synopsis

upeval [level] script

Description

The upeval command evaluates script one stack frame up from the current stack frame, if level is not present. If level is present, upeval behaves like so: if level is less than one, the script is run that many levels down from the top of the stack. If it's 0, the script is run at the global level, and if it's a positive number, the script is run at that absolute level up from the global namespace.

Example

proc stackframe {} {
    upeval { incr $foo }
}
set foo 1
stackframe
puts $foo
	  

Produces:

2