# `Yarnspinnex.Cursor`
[🔗](https://github.com/atavistock/yarnspinnex/blob/main/lib/yarnspinnex/cursor.ex#L1)

A position in a running dialogue: the current node, the path into it, the variables the
dialogue owns (keyed by bare name, so `$gold` in a script is `"gold"` here), and the fingerprint
of the node it is in. Plain data with no reference to the script itself and none of the
host's context, so it can be persisted (`:erlang.term_to_binary/1`), copied, and resumed later.

# `selector`

```elixir
@type selector() :: {:if, non_neg_integer() | :else} | {:option, non_neg_integer()}
```

Which branch of an `<<if>>` (by position, or `:else`) or which option of a group was taken.

# `t`

```elixir
@type t() :: %Yarnspinnex.Cursor{
  fingerprint: non_neg_integer(),
  index: non_neg_integer(),
  node: String.t(),
  path: [{non_neg_integer(), selector()}],
  vars: %{optional(String.t()) =&gt; term()}
}
```

`path` lists the enclosing `<<if>>`/option groups innermost first, each as the statement index
of that construct in its own list plus the selector taken; `index` is the next statement in the
innermost list. `fingerprint` is the node's entry in `Yarnspinnex.Script` `fingerprints`.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
