How to create and set tcldictionary variable using tcl/java?

165 views Asked by At

I am using tcl/java where I am trying to create some TCLDict object and setting that dictionary object to a dictionary variable in tcl script using setVar from TCLInterpreter. Could someone guide me how to create a TCLDictionary and setting it using setVar in JAVA?

Thanks in advance.

1

There are 1 answers

1
wolfhammer On

You could try to use setVar to create a text string of the serialized dictionary. Here's a simple dictionary tcl. I image if you setVar the dictionary you could use the getter in tcl.

testdict.tcl

#!/usr/bin/tclsh

dict set addresses home "Maple Street"
dict set addresses office "Downtown"

puts $addresses

puts [dict get $addresses office]

output:

./testdict.tcl
home {Maple Street} office Downtown
Downtown

So in thiis case I image a setVar("addresses", "home {Maple Street} office Downtown") or whatever the syntax may be should get you a dictionary in tcl.