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

Fun with Datasets pt. 2 (Harlowe)

$
0
0
Okay, why does this:
(set: $data to (a:1,2,3))
(set: $set to (dataset:))

(set:$set to it + (dataset:$data))
(print:$set's length)
(set:$set to it + (dataset:$data))
(print:$set's length)

(set: $choice to $data)
(set:$set to it + (dataset:$choice))
(print:$set's length)
(set:$set to it + (dataset:$choice))
(print:$set's length)

(set: $choice to $data)
(set:$set to it + (dataset:$choice))
(print:$set's length)
output this?
1
1

2
2

3

Datasets shouldn't be able to hold duplicates, so why doesn't Harlowe treat a variable holding something already inside the dataset, or even the same variable already in the dataset (after being set again) as duplicates?

Sorry for the larger than necessary amount of prints; I just wanted to clearly illustrate what does and doesn't get added to a dataset. Notable also is that if $data is a string, number, or boolean, it works no problem, but I have to use datasets containing arrays. :/

Viewing all articles
Browse latest Browse all 1844

Trending Articles