name of a variable stored in another variable 
Author Message
 name of a variable stored in another variable

using itcl!

e.g.:

set var($this) 0

set dummy [scope var($this)]

puts "dummy = $dummy"   ---->  dummy = <class_name>::var(<namespace>)

----------------

this is fine, but what do i do if i want the value of var($this) ???

something like:

puts "$$dummy"   ----> but this gives me a syntax error

thx for help, because i'm nearly tearing my hear out! ;-)

jessi



Fri, 02 Jul 2004 22:32:26 GMT  
 name of a variable stored in another variable

Quote:

> using itcl!

> e.g.:

> set var($this) 0

> set dummy [scope var($this)]

> puts "dummy = $dummy"   ---->  dummy = <class_name>::var(<namespace>)

> ----------------

> this is fine, but what do i do if i want the value of var($this) ???

> something like:

Something like

set dummy [set $var($this)]

?

L

--

Why is it that when you're driving and looking for an address, you turn
down the volume on the radio?



Fri, 02 Jul 2004 22:58:20 GMT  
 name of a variable stored in another variable
Try
puts "$[set dummy]"

jessi a crit :

Quote:
> using itcl!

> e.g.:

> set var($this) 0

> set dummy [scope var($this)]

> puts "dummy = $dummy"   ---->  dummy = <class_name>::var(<namespace>)

> ----------------

> this is fine, but what do i do if i want the value of var($this) ???

> something like:

> puts "$$dummy"   ----> but this gives me a syntax error

> thx for help, because i'm nearly tearing my hear out! ;-)

> jessi

--
Yann Rapaport

6Wind, the New Internet
http://www.6Wind.com



Fri, 02 Jul 2004 22:58:54 GMT  
 name of a variable stored in another variable

Quote:
> puts "$$dummy"   ----> but this gives me a syntax error

puts "[set $dummy]"


Sat, 03 Jul 2004 00:05:57 GMT  
 name of a variable stored in another variable

Quote:

> using itcl!

> e.g.:

> set var($this) 0

> set dummy [scope var($this)]

> puts "dummy = $dummy"   ---->  dummy = <class_name>::var(<namespace>)

> ----------------

> this is fine, but what do i do if i want the value of var($this) ???

> something like:

> puts "$$dummy"   ----> but this gives me a syntax error

> thx for help, because i'm nearly tearing my hear out! ;-)

> jessi

upvar [scope var($this)] dummy
puts $dummy

Michael



Sat, 03 Jul 2004 16:32:25 GMT  
 name of a variable stored in another variable

Quote:

> thx for help, because i'm nearly tearing my hear out! ;-)

thank you guys!! works perfekt!

you saved me beeing bold headed for the rest of my life! ;-))

jessi



Sat, 03 Jul 2004 18:25:23 GMT  
 
 [ 6 post ] 

 Relevant Pages 

1. Using a variable name for a variable name??

2. reading Variables witsch stored in variables

3. Storing fn name as character variable

4. variable contents to variable name

5. array name in variable variable

6. getting variable name from the variable itself?

7. Variables containing variable names

8. Variable variable names?

9. values of variable variable-names

10. Class variables / global variables / Init variables

11. field name and key name as a variable

12. field name and key name as a variable

 

 
Powered by phpBB® Forum Software