0

我正在使用 tcl/java,我正在尝试创建一些 TCLDict 对象,并使用 TCLInterpreter 中的 setVar 将该字典对象设置为 tcl 脚本中的字典变量。有人可以指导我如何创建 TCLDictionary 并在 JAVA 中使用 setVar 设置它吗?

提前致谢。

4

1 回答 1

0

您可以尝试使用 setVar 创建序列化字典的文本字符串。这是一个简单的字典 tcl。我想如果你 setVar 字典,你可以在 tcl 中使用 getter。

测试字典.tcl

#!/usr/bin/tclsh

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

puts $addresses

puts [dict get $addresses office]

输出:

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

所以在这种情况下,我想象一个 setVar("addresses", "home {Maple Street} office Downtown") 或任何可能的语法都应该为您提供 tcl 中的字典。

于 2015-01-12T20:10:03.050 回答