You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
-[x] Migration: the ability to implement the migration of player's saves after the book update
@@ -101,10 +101,10 @@ end
101
101
### Known limitations
102
102
103
103
- Choice's title can't contain inline conditions or alternatives
104
-
- Choice can't have few conditions like ```* { a } { b }```. *The solution is using ```* { a && b } ``` instead.*
105
-
- There is no query functions ```TURNS()``` and ```TURNS_SINCE()```
106
-
- A list uses only standard numerical values ```1, 2, 3...```. Can't define your own numerical values like ```4, 7, 12...```.
107
-
- A comment in the middle of the paragraph ```before /* comment */ and after``` splits it into two paragraphs ```before``` and ```and after```
104
+
- Choice can't have few conditions like `* { a } { b }`. *The solution is using `* { a && b } ` instead.*
105
+
- There is no query functions `TURNS()` and `TURNS_SINCE()```
106
+
- A list uses only standard numerical values `1, 2, 3...`. Can't define your own numerical values like `4, 7, 12...`.
107
+
- A comment in the middle of the paragraph `before /* comment */ and after` splits it into two paragraphs `before` and `and after```
108
108
109
109
## Alternatives
110
110
@@ -118,7 +118,7 @@ end
118
118
119
119
### Common case (Löve, pure Lua, etc.)
120
120
121
-
Download the latest [release archive](https://github.com/astrochili/narrator/releases) and require the ```narrator``` module.
121
+
Download the latest [release archive](https://github.com/astrochili/narrator/releases) and require the `narrator` module.
122
122
123
123
```lua
124
124
localnarrator=require('narrator.narrator')
@@ -130,7 +130,7 @@ Narrator requires [lpeg](http://www.inf.puc-rio.br/~roberto/lpeg/) as dependency
130
130
$ luarocks install lpeg
131
131
```
132
132
133
-
In fact, you don't need ```lpeg``` in the release, but you need it locally to parse Ink content and generate lua versions of books to play in your game. Use parsing in development only, prefer already parsed and stored books in production.
133
+
In fact, you don't need `lpeg` in the release, but you need it locally to parse Ink content and generate lua versions of books to play in your game. Use parsing in development only, prefer already parsed and stored books in production.
@@ -151,9 +151,9 @@ local narrator = require('narrator.narrator')
151
151
152
152
### narrator.parse_file(path, params)
153
153
154
-
Parses the Ink file at path with all the inclusions and returns a book instance. Path notations ```'stories/game.ink'```, ```'stories/game'``` and ```'stories.game'``` are valid.
154
+
Parses the Ink file at path with all the inclusions and returns a book instance. Path notations `'stories/game.ink'`, `'stories/game'` and `'stories.game'` are valid.
155
155
156
-
You can save a parsed book to the lua file with the same path by passing ```{ save = true }``` as ```params``` table. By default, the ```params``` table is ```{ save = false }```.
156
+
You can save a parsed book to the lua file with the same path by passing `{ save = true }` as `params` table. By default, the `params` table is `{ save = false }`.
157
157
158
158
```lua
159
159
-- Parse a Ink file at path 'stories/game.ink'
@@ -163,11 +163,11 @@ local book = narrator.parse_file('stories.game')
Reading and saving files required ```io``` so if you can't work with files by this way use ```narrator.parse_content()```.
166
+
Reading and saving files required `io` so if you can't work with files by this way use `narrator.parse_content()`.
167
167
168
168
### narrator.parse_content(content, inclusions)
169
169
170
-
Parses the string with Ink content and returns a book instance. The ```inclusions``` param is optional and can be used to pass an array of strings with Ink content of inclusions.
170
+
Parses the string with Ink content and returns a book instance. The `inclusions` param is optional and can be used to pass an array of strings with Ink content of inclusions.
171
171
172
172
```lua
173
173
localcontent='Content of a root Ink file'
@@ -183,11 +183,11 @@ local book = narrator.parse_content(content)
Content parsing is useful when you should manage files by your engine environment and don't want to use ```io``` module. For example, in Defold, you may want to load ink files as custom resources with [sys.load_resource()](https://defold.com/ref/sys/#sys.load_resource:filename).
186
+
Content parsing is useful when you should manage files by your engine environment and don't want to use `io` module. For example, in Defold, you may want to load ink files as custom resources with [sys.load_resource()](https://defold.com/ref/sys/#sys.load_resource:filename).
187
187
188
188
### narrator.init_story(book)
189
189
190
-
Inits a story instance from the book. This is aclual to use in production. For example, just load a book with ```require()``` and pass it to this function.
190
+
Inits a story instance from the book. This is aclual to use in production. For example, just load a book with `require()` and pass it to this function.
191
191
192
192
```lua
193
193
-- Require a parsed and saved before book
@@ -213,11 +213,11 @@ end
213
213
214
214
### story:continue(steps)
215
215
216
-
Get the next paragraphs. You can specify the number of paragraphs that you want to pull by the ```steps``` param.
217
-
- Pass nothing if you want to get all the currently available paragraphs. ```0``` also works.
218
-
- Pass ```1``` if you want to get one next paragraph without wrapping to array.
216
+
Get the next paragraphs. You can specify the number of paragraphs that you want to pull by the `steps` param.
217
+
- Pass nothing if you want to get all the currently available paragraphs. `0` also works.
218
+
- Pass `1` if you want to get one next paragraph without wrapping to array.
219
219
220
-
A paragraph is a table like ```{ text = 'Hello.', tags = { 'tag1', 'tag2' } }```. Most of the paragraphs do not have tags so ```tags``` can be ```nil```.
220
+
A paragraph is a table like `{ text = 'Hello.', tags = { 'tag1', 'tag2' } }`. Most of the paragraphs do not have tags so `tags` can be `nil`.
221
221
222
222
223
223
```lua
@@ -230,7 +230,7 @@ local paragraph = story:continue(1)
230
230
231
231
### story:can_choose()
232
232
233
-
Returns a boolean, does the story have choices to output or not. Also returns ```false``` if there are available paragraphs to continue.
233
+
Returns a boolean, does the story have choices to output or not. Also returns `false` if there are available paragraphs to continue.
234
234
235
235
```lua
236
236
ifstory:can_choose() do
@@ -242,9 +242,9 @@ end
242
242
243
243
Returns an array of available choices. Returns an empty array if there are available paragraphs to continue.
244
244
245
-
A choice is a table like ```{ text = 'Bye.', tags = { 'tag1', 'tag2' } }```. Most of the choices do not have tags so ```tags``` can be ```nil```.
245
+
A choice is a table like `{ text = 'Bye.', tags = { 'tag1', 'tag2' } }`. Most of the choices do not have tags so `tags` can be `nil`.
246
246
247
-
Choice tags are not an official feature of Ink, but it's a Narrator feature. These tags also will appear in the answer paragraph as it works in Ink by default. But if you have a completely eaten choice like ```'[Answer] #tag'``` you will receive tags only in the choice.
247
+
Choice tags are not an official feature of Ink, but it's a Narrator feature. These tags also will appear in the answer paragraph as it works in Ink by default. But if you have a completely eaten choice like `'[Answer] #tag'` you will receive tags only in the choice.
248
248
249
249
```lua
250
250
-- Get available choices and output them to the player
@@ -256,7 +256,7 @@ Choice tags are not an official feature of Ink, but it's a Narrator feature. The
256
256
257
257
### story:choose(index)
258
258
259
-
Make a choice to continue the story. Pass the ```index``` of the choice that you was received with ```get_choices()``` before. Will do nothing if ```can_continue()``` returns ```false```.
259
+
Make a choice to continue the story. Pass the `index` of the choice that you was received with `get_choices()` before. Will do nothing if `can_continue()` returns `false`.
260
260
261
261
```lua
262
262
-- Get the answer from the player in the terminal
@@ -271,7 +271,7 @@ Make a choice to continue the story. Pass the ```index``` of the choice that you
271
271
272
272
### story:jump_to(path_string)
273
273
274
-
Jumps to the path. The ```path_string``` param is a string like ```'knot.stitch.label'```.
274
+
Jumps to the path. The `path_string` param is a string like `'knot.stitch.label'`.
275
275
276
276
```lua
277
277
-- Jump to the maze stitch in the adventure knot
@@ -283,7 +283,7 @@ Jumps to the path. The ```path_string``` param is a string like ```'knot.stitch.
283
283
284
284
### story:get_visits(path_string)
285
285
286
-
Returns the number of visits to the path. The ```path_string``` param is a string like ```'knot.stitch.label'```.
286
+
Returns the number of visits to the path. The `path_string` param is a string like `'knot.stitch.label'`.
287
287
288
288
```lua
289
289
-- Get the number of visits to the maze's red room
@@ -295,7 +295,7 @@ local adventure_visits = story:get_visits('adventure')
295
295
296
296
### story:get_tags(path_string)
297
297
298
-
Returns tags for the path. The ```path_string``` param is a string like ```'knot.stitch'```. This function is useful when you want to get tags before continue the story and pull paragraphs. Read more about it [here](https://github.com/inkle/ink/blob/master/Documentation/RunningYourInk.md#knot-tags).
298
+
Returns tags for the path. The `path_string` param is a string like `'knot.stitch'`. This function is useful when you want to get tags before continue the story and pull paragraphs. Read more about it [here](https://github.com/inkle/ink/blob/master/Documentation/RunningYourInk.md#knot-tags).
299
299
300
300
```lua
301
301
-- Get tags for the path 'adventure.maze'
@@ -404,7 +404,7 @@ This is the place where you can rename or change variables, visits, update the c
The ```old_version``` is the version of the saved state, the ```new_version``` is the version of the book. You can specify the verson of the book with the constant ```'version'``` in the Ink content, otherwise it's equal to ```0```.
407
+
The `old_version` is the version of the saved state, the `new_version` is the version of the book. You can specify the verson of the book with the constant `'version'` in the Ink content, otherwise it's equal to `0`.
408
408
409
409
```lua
410
410
-- A migration function example
@@ -446,9 +446,9 @@ There are some useful extensions and configs for [VSCode](https://code.visualstu
446
446
447
447
-[Local Lua Debugger](https://github.com/tomblind/local-lua-debugger-vscode) by [tomblind](https://github.com/tomblind/).
448
448
-[Lua Language Server](https://github.com/sumneko/lua-language-server) by [sunmeko](https://github.com/sumneko).
449
-
- A task named ```Busted``` runs tests with ```tests/run.lua```.
450
-
- A lunch configuration named ```Busted``` runs the debugger with ```tests/run.lua```.
451
-
- A lunch configuration named ```Debug``` runs the debugger with ```debug.lua```.
449
+
- A task named `Busted` runs tests with `tests/run.lua`.
450
+
- A lunch configuration named `Busted` runs the debugger with `tests/run.lua`.
451
+
- A lunch configuration named `Debug` runs the debugger with `debug.lua`.
0 commit comments