This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

upvrar in namespace

Help for those learning Tcl or writing their own scripts.
Post Reply
User avatar
caesar
Mint Rubber
Posts: 3776
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

upvrar in namespace

Post by caesar »

Why can't use upvar on a variable that is defined outside the proc that is in a namespace?

I tried something like:

Code: Select all

namespace eval blah {
	set foo 1
	proc moo {x} {
		upvar #0 $x var
		puts $var
	}
}
and other ways but all fail. From what I read a upvar #0 should be the equivalent of a global call but that fails as well, meaning the var variable isn't created.

If I take the code outside the namespace then it's working as expected. What am I doing wrong?
Once the game is over, the king and the pawn go back in the same box.
Post Reply