Showing a choice

Use the choice function to display a choice between one or more options to the player. By default, choices are displayed as a vertical list of buttons but you can change that if you want to. For more information on changing the appearance, see “Replacing built-in screens”

Reacting to a choice (branching)

The choice function returns the number of the selected option (starting at 1). By storing this number in a variable (the variable is named selected in the example) you can react to the selection made by the player. I

Persistent storage

Sometimes you want choices to affect not just the current playthrough, but also unlock things permanently for future playthroughs. A typical use for this would be a “route cleared” flag, or a gallery of bonus content that unlocks after finishing the game. To store/load such data, use the setSharedGlobal/getSharedGlobal functions, see save.lua for details.