Documentation ¶
Overview ¶
Package story encapsulates routines for managing a Create Your Own Adventure story
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Chapter ¶
type Chapter struct { Title string `json:"title"` Paragraphs []string `json:"story"` Options []struct { Text string `json:"text"` Title string `json:"arc"` } `json:"options"` }
Chapter encapsulates a chapter of a story
type Story ¶
type Story struct {
// contains filtered or unexported fields
}
Story encapsulates a set of chapters, indexed by string id
func FromJSONFile ¶
FromJSONFile receives a json filename as argument, attempts to parse it and return a struct of type Story. In case of an issue with the file or json contents, an error is returned.
func (*Story) ChapterByID ¶
ChapterByID attempts to find a chapter in the story by the provided id. In case one is not found, an error is returned.
func (*Story) IntroChapter ¶
IntroChapter attempts to find a chapter in the story by the intro id of the story. In case one is not found, an error is returned.
Click to show internal directories.
Click to hide internal directories.