Version 3 of info level

Updated 2003-09-09 03:49:44

info level ?number?

If number is not specified, this command returns a number giving the stack level of the invoking procedure, or 0 if the command is invoked at top-level. If number is specified, then the result is a list consisting of the name and arguments for the procedure call at level number on the stack. If number is positive then it selects a particular stack level (1 refers to the top-most active procedure, 2 to the procedure it called, and so on); otherwise it gives a level relative to the current level (0 refers to the current procedure, -1 to its caller, and so on). See the uplevel command for more information on what stack levels mean.


See also:


MGS [2003/09/09] - Note that info level 0 does not return values for optional arguments:

 proc foo {bar {baz NULL}} {
   puts "info level 0 = \[[info level 0]\]"
 }

   # example1
   foo abc def
   # example2
   foo abc

prints:

 info level 0 = [foo abc def]
 info level 0 = [foo abc]

DGP Correct. [info level $level] returns the substituted list of values that make up the actual command as evaluated.


Category Command - Tcl syntax help