Metadata macro documentation has potentially broken example
Tested using 3.3.8.
The metadata macro's documentation (https://twine2.neocities.org/#macro_metadata) contains this example:
(metadata: "rarity", 5)
in a passage called "Adamantium" causes(passage: "Adamantium")'s rarity
to be5
. You can then use(passages: where it contains 'rarity' and its rarity >= (random: 1, 10))
to get a list of passages that may randomly exclude the "Adamantium" passage.
This example appears to be incorrect, as experimentally using (passages: where <condition> and <condition>)
appears to run both conditions in parallel, not in sequence (as Hituro in the Twine Discord said, "The problem is that there is no short-circuit evaluation in the lambda, so both parts are run simultaneously"). As a result, the its rarity >= (random: 1, 10)
condition is tested against all passages, not just those that have a rarity
property (which presumably the where it contains 'rarity'
condition is supposed to select for).
If conditions are correctly supposed to run in parallel, then the documentation can be corrected by re-writing the example (passages:)
macro call as (find: _passages where its 'rarity' >= (random: 1, 10), ...(passages: where it contains 'rarity')))
.
If instead conditions are supposed to run in sequence, then the documentation is correct but instead there is a bug in how Harlowe 3.3.8 processes multiple conditions in a call to (passages:)
.
Let me know if you need any other detail (I have a working example in which multiple conditions in a call to (passages:)
as per the documentation does not work as implied).