aboutsummaryrefslogtreecommitdiff
path: root/runtime/doc/lua.txt
diff options
context:
space:
mode:
Diffstat (limited to 'runtime/doc/lua.txt')
-rw-r--r--runtime/doc/lua.txt19
1 files changed, 19 insertions, 0 deletions
diff --git a/runtime/doc/lua.txt b/runtime/doc/lua.txt
index f7f722bc0e..7e0ad5f4c3 100644
--- a/runtime/doc/lua.txt
+++ b/runtime/doc/lua.txt
@@ -3639,6 +3639,25 @@ Iter:slice({first}, {last}) *Iter:slice()*
Return: ~
Iter
+Iter:take({n}) *Iter:take()*
+ Transforms an iterator to yield only the first n values.
+
+ Example: >lua
+ local it = vim.iter({ 1, 2, 3, 4 }):take(2)
+ it:next()
+ -- 1
+ it:next()
+ -- 2
+ it:next()
+ -- nil
+<
+
+ Parameters: ~
+ • {n} (integer)
+
+ Return: ~
+ Iter
+
Iter:totable() *Iter:totable()*
Collect the iterator into a table.