Re: [tcljava-user] Using global variable in Tcl script
Brought to you by:
mdejong
From: Kristoffer L. <se...@fi...> - 2007-01-25 09:04:10
|
On 25 Jan 2007, at 10:52, Pham Ngoc Khanh wrote: > Hi all, > > I have a situation like this: > 1. From Java: > interp.setVar("id", TclString.newInstance("123"), > TCL.GLOBAL_ONLY); > > 2. In Tcl script: > proc myProc { } { > # need to get the value of variable id set from > Java > } > > How to get the id variable in proc myProc ? This is elementary Tcl. I recommend reading a good tutorial on this. Anyway, you can use the 'global' command: proc myProc {} { global id # ... } As a sidenote and depending on the project, I'd be careful about using a name such as 'id' in the global namespace as that could easily conflict. / http://www.fishpool.com/~setok/ |