Quantcast
Channel: Help! with 2.0 - Twine Forum
Viewing all articles
Browse latest Browse all 1844

Array contains object - problem

$
0
0
Twine 2, SigarCube 2.x

Example setup:
StoryInit: <<set $object to {name: "name"}>> <<set $Array to []>>
Passage: <<if visited() <2>><<set $Array.push($object)>><<endif>> <<print $Array.includes($object)>>
______________________________________________________________________________________________________________
The first time Passage is visited, object is pushed to Array, and Array knows it cointans the object. But it's the only moment it does! Every other time Array will print "false", telling that it does not contain object (or -1 if indexOf is used), even though it still DOES, because $Array[0].name is totally accessible and would print "name" without a problem...

Anyone knows why it doesn't work and how to do it right? It got me stuck so bad right now, I'm totally out of ideas :( It happens only to objects, checking normal variable the same way works without problems.

Viewing all articles
Browse latest Browse all 1844

Trending Articles