Pulling on threads
Diverts were introduced as pointing to their destination. To create a tunnel, a hyphen and a greater-than symbol were combined, ->
, on either side of the name of the knot or stitch. However, diverts can point inward as well. When a divert is created with a less-than symbol and a hyphen, <-
, it becomes a different concept called a thread. Instead of moving the flow to the destination, ink threads the destination's text or code into another location.
In this section, we will work with threads to collapse more complex weaves into simpler structures. Instead of multiple levels of choices and their text outcomes, we will use threads to achieve the same result in a more efficient way.
Making threads
Often, threads are considered to be an inverse of diverts. Instead of the flow moving to the section of the story, the section of the story moves to the current position of the flow. Returning to the code from Example 4, threads can be used in multiple places...