Twine Version: 2.9.2
Story Format: Sugarcube 2.36.1
I’m new to Sugarcube so I apologize in advance if I’m being stupid but I couldn’t find anything related to what I was searching for. I have a dictionary of dictionaries representing companies and their attributes (e.g. name, bio, and other stuff i’m going to add later). I wanted to make an expandable way to view all the company’s about sections, so I used this code:
:: Main
<<set $companies to {
"company1":{"Name":"Company 1","About":"About Company 1"},
"company2":{"Name":"Company 2","About":"About Company 2"},
"company3":{"Name":"Company 3, the best one","About":"About company 3"}
}>>
<<set $index to ["company1","company2","company3"]>>
<<for _i to 0; _i lt $index.length; _i++>>
About <<link $companies[$index[_i]]["Name"] "About">>
<<set $about to $companies[$index[_i]]["About"]>>
<</link>>
<</for>>
:: About
<<print $about>>
When I run this, I get the error Error: <<set>>>: bad evaluation: Cannot read properties of undefined (reading 'About').
If I add a <<goto "About>>
in the <<for>>
loop, the error still pops up and when I close it I the “About” passage just shows [undefined]
. What do I need to change to fix this?