aboutsummaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorAlbert Krewinkel <[email protected]>2024-10-01 14:38:45 +0200
committerAlbert Krewinkel <[email protected]>2024-10-14 07:15:34 +0200
commit734227a59d416e4512f418468c714b59585cb5e2 (patch)
tree38ed3607a0b8479fef17d0f78771970f0b008880 /doc
parentc8fda8f4d38a05fd494e7ee74d9c75930bdbcf12 (diff)
doc/lua-filters.md: document `pandoc.List:iter` method
List objects have a new function `iter` that returns an iterator function that returns the next list item on each call.
Diffstat (limited to 'doc')
-rw-r--r--doc/lua-filters.md22
1 files changed, 22 insertions, 0 deletions
diff --git a/doc/lua-filters.md b/doc/lua-filters.md
index 05e8d743c..913d57f02 100644
--- a/doc/lua-filters.md
+++ b/doc/lua-filters.md
@@ -4688,6 +4688,28 @@ Parameters:
`value`
: value to insert into the list
+### `pandoc.List:iter ([step])` {#pandoc.list:iter}
+
+Create an iterator over the list. The resulting function returns the
+next value each time it is called.
+
+Usage:
+
+ for item in List{1, 1, 2, 3, 5, 8}:iter() do
+ -- process item
+ end
+
+Parameters:
+
+`step`
+: step width with which to step through the list. Negative step sizes
+ will cause the iterator to start from the end of the list. Defaults
+ to 1. (integer)
+
+Returns:
+
+- iterator (function)
+
### `pandoc.List:map (fn)` {#pandoc.list:map}
Returns a copy of the current list by applying the given