It looks like you're new here. If you want to get involved, click one of these buttons!
<<set $Alice = {Eliza:{tru:2, adm:-1, aff:3, att:-3}}>>
<<set $Eliza = {Alice:{tru:-1, adm:2, aff:1, att:1}}>>
<<set $matrix = {Alice:$Alice, Eliza:$Eliza}
and then I print out the $matrix object in a later passage:
<<print JSON.stringify($matrix)>>
...I noticed that the first element, Alice, was printing as 0. If I swapped Alice and Eliza, then Eliza was printing as 0. So I declared a "dummy object" before everything (<<set $foo = {}>>
) and finally everything printed out the way I expected. Seems like a bug! Or is there some sensible explanation for this behavior?<<print JSON.stringify($matrix.$char)>>
where $char can be set to "Alice" or "Eliza", does not work. I get a red Twine error saying that $char is not defined. Is there any way to make this work right?
Comments
Also, I recommend using JSON.stringify(variableName, null, true) instead of plain JSON.stringify(variableName), because it prints in a more readable fashion.
As for the first error.... would it be OK to show me a HTML file where the bug occurs? I can't seem to replicate it.