[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [ns]Tcl variable name from C++



> > There is a way to lookup an object if you know the name that Tcl gives it 
> > using TclObject::lookup(_o121). But is there a way of getting the actual 
> > variable name from this ?
> > 
> > As an example if I have
> > 
> > set node1 [$ns node]
> > 
> > then $node1 is of the form _o121 or similar. Can I get, from C++, the fact 
> > that it is called 'node1'.
> 
> Try this:
> 
> set node1 [$ns node]
> $node1 set tclname node1
> 
> then from C++
> 
> pNode = (Node*)TclObject::lookup(..);
> Tcl::instance().evalf("%s set tclname");
Sorry! Above should be:
  Tcl::instance().evalf("%s set tclname", pNode->name());

George