I am trying to use a Var as a temporary store for a JScript object, but it does not seem to work. Am I missing something or is this a bug?
Test script bellow. Expectation was that after running QuickTest
a second time, no error would arise.
function OnInit(initData)
{
initData.name = "QuickTest";
initData.default_enable = true;
var cmd = initData.AddCommand();
cmd.name = "QuickTest";
cmd.method = "Main";
cmd.desc = initData.desc;
cmd.label = initData.name;
cmd.template = "";
}
function Main(clickData)
{
DOpus.output("---------------------------------");
var varName = "results";
if (DOpus.Vars.Exists(varName)) {
var varValue1 = DOpus.Vars.Get(varName);
DOpus.Vars.Delete(varName)
DOpus.output("typeof varValue1 = " + typeof varValue1);
var a_stream = varValue1["a"];
DOpus.output("typeof a_stream = " + typeof a_stream);
}
else {
var result = {};
result["a"] = "a";
result["b"] = "b";
result["c"] = "c";
DOpus.Vars.Set(varName, result);
var varValue1 = DOpus.Vars.Get(varName);
DOpus.output("typeof varValue1 = " + typeof varValue1);
var a_stream = varValue1["a"];
DOpus.output("typeof a_stream = " + typeof a_stream);
DOpus.output(a_stream);
}
}