Well, the first thing I’d do in this context is use available syntax:
function callMyFunction(theDict:dictionary){...
Though this isn’t that issue. Consider this simple test:
var:dictionary target;
target["myA"] = "A";
target["myB"] = "B";
target["myC"] = "C";
target["myD"] = "D";
var:list targetList = target;
$Text(/logA) = "String value is: `"+target+"'";
$Text(/logA) += "\ntarget.size is: "+target.size;
$Text(/logA) += "\ntarget.keys.size is: "+target.keys.size;
$Text(/logA) += "\ntarget.keys.count is: "+target.keys.count;
$Text(/logA) += "\ntarget.asString.size is: "+target.asString.size;
$Text(/logA) += "\ndictionary as list, targetList.size is: "+targetList.size;
results:
String value is: `myC:C;myB:B;myA:A;myD:D'
target.size is: 4
target.keys.size is: 4
target.keys.count is: 4
target.asString.size is: 23
dictionary as list, targetList.size is: 4
A dictionary is a list of key:pair values. Tinderbox is treating the dictionary ‘size’ as that number of list items (list.size) not the number of characters (string.size). so what’s at play here is some internal type coercion. IOW, a (dictionary) string that looks to Tinderbox link a list is treated as a list when using .size.
No foul here, but this is exactly what List.asString() is for. So, your test needs to be:
target.asString.size
TBH, I didn’t have a fixed assumption as to Dictionary.size should be as its not a documented form. I’d use Dictionary.keys.count (.size deprecated here for .count) for the key count or Dictionary.asString.size for the character count of all key:value; contents