From d9d890562e43493c999f8a6ff2b848959686f5b6 Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Sun, 21 Apr 2024 15:19:43 +0200 Subject: refactor(lua): rename tbl_islist => islist ref #24572 --- runtime/doc/deprecated.txt | 1 + runtime/doc/lua.txt | 36 ++++++++++++++++++------------------ runtime/doc/news.txt | 5 ++++- 3 files changed, 23 insertions(+), 19 deletions(-) (limited to 'runtime/doc') diff --git a/runtime/doc/deprecated.txt b/runtime/doc/deprecated.txt index 1b57f34896..976bc05a64 100644 --- a/runtime/doc/deprecated.txt +++ b/runtime/doc/deprecated.txt @@ -172,6 +172,7 @@ LUA - vim.register_keystroke_callback() Use |vim.on_key()| instead. - *vim.pretty_print()* Use |vim.print()| instead. - *vim.loop* Use |vim.uv| instead. +- *vim.tbl_islist()* Use |vim.islist()| instead. - *vim.tbl_add_reverse_lookup()* NORMAL COMMANDS diff --git a/runtime/doc/lua.txt b/runtime/doc/lua.txt index dc1a4bb35d..3561c77dd5 100644 --- a/runtime/doc/lua.txt +++ b/runtime/doc/lua.txt @@ -2029,6 +2029,23 @@ vim.is_callable({f}) *vim.is_callable()* Return: ~ (`boolean`) `true` if `f` is callable, else `false` +vim.islist({t}) *vim.islist()* + Tests if `t` is a "list": a table indexed only by contiguous integers + starting from 1 (what |lua-length| calls a "regular array"). + + Empty table `{}` is a list, unless it was created by |vim.empty_dict()| or + returned as a dict-like |API| or Vimscript result, for example from + |rpcrequest()| or |vim.fn|. + + Parameters: ~ + • {t} (`table?`) + + Return: ~ + (`boolean`) `true` if list-like table, else `false`. + + See also: ~ + • |vim.tbl_isarray()| + vim.list_contains({t}, {value}) *vim.list_contains()* Checks if a list-like table (integer keys without gaps) contains `value`. @@ -2284,7 +2301,7 @@ vim.tbl_isarray({t}) *vim.tbl_isarray()* non-contiguous). If the indexes start from 1 and are contiguous then the array is also a - list. |vim.tbl_islist()| + list. |vim.islist()| Empty table `{}` is an array, unless it was created by |vim.empty_dict()| or returned as a dict-like |API| or Vimscript result, for example from @@ -2311,23 +2328,6 @@ vim.tbl_isempty({t}) *vim.tbl_isempty()* See also: ~ • https://github.com/premake/premake-core/blob/master/src/base/table.lua -vim.tbl_islist({t}) *vim.tbl_islist()* - Tests if `t` is a "list": a table indexed only by contiguous integers - starting from 1 (what |lua-length| calls a "regular array"). - - Empty table `{}` is a list, unless it was created by |vim.empty_dict()| or - returned as a dict-like |API| or Vimscript result, for example from - |rpcrequest()| or |vim.fn|. - - Parameters: ~ - • {t} (`table`) - - Return: ~ - (`boolean`) `true` if list-like table, else `false`. - - See also: ~ - • |vim.tbl_isarray()| - vim.tbl_keys({t}) *vim.tbl_keys()* Return a list of all keys used in a table. However, the order of the return table of keys is not guaranteed. diff --git a/runtime/doc/news.txt b/runtime/doc/news.txt index 7da6fb4ff8..ed7da4f9de 100644 --- a/runtime/doc/news.txt +++ b/runtime/doc/news.txt @@ -22,7 +22,7 @@ The following changes may require adaptations in user config or plugins. set guicursor+=n-v-c:blinkon500-blinkoff500 < -• |vim.tbl_islist()| now checks whether a table is actually list-like (i.e., +• |vim.islist()| now checks whether a table is actually list-like (i.e., has integer keys without gaps and starting from 1). For the previous behavior (only check for integer keys, allow gaps or not starting with 1), use |vim.tbl_isarray()|. @@ -155,6 +155,8 @@ unreleased features on Nvim HEAD. • Removed vim.iter.map(), vim.iter.filter(), vim.iter.totable(). +• Renamed vim.tbl_islist() to vim.islist(). + ============================================================================== NEW FEATURES *news-features* @@ -563,5 +565,6 @@ release. • vim.shared functions: - |vim.tbl_add_reverse_lookup()| + - |vim.tbl_islist()| vim:tw=78:ts=8:sw=2:et:ft=help:norl: -- cgit From 5c8dfb0e379cd4ae8de418e7aa554dbc5ab7f236 Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Sun, 21 Apr 2024 17:29:10 +0200 Subject: refactor(lua): rename tbl_isarray => isarray tbl_isarray was not released yet, so it will not go through a deprecation cycle. ref #24572 --- runtime/doc/deprecated.txt | 2 +- runtime/doc/lua.txt | 42 +++++++++++++++++++++--------------------- runtime/doc/news.txt | 6 +++--- 3 files changed, 25 insertions(+), 25 deletions(-) (limited to 'runtime/doc') diff --git a/runtime/doc/deprecated.txt b/runtime/doc/deprecated.txt index 976bc05a64..ac512ddd35 100644 --- a/runtime/doc/deprecated.txt +++ b/runtime/doc/deprecated.txt @@ -172,8 +172,8 @@ LUA - vim.register_keystroke_callback() Use |vim.on_key()| instead. - *vim.pretty_print()* Use |vim.print()| instead. - *vim.loop* Use |vim.uv| instead. -- *vim.tbl_islist()* Use |vim.islist()| instead. - *vim.tbl_add_reverse_lookup()* +- *vim.tbl_islist()* Use |vim.islist()| instead. NORMAL COMMANDS - *]f* *[f* Same as "gf". diff --git a/runtime/doc/lua.txt b/runtime/doc/lua.txt index 3561c77dd5..de1e432790 100644 --- a/runtime/doc/lua.txt +++ b/runtime/doc/lua.txt @@ -2029,6 +2029,26 @@ vim.is_callable({f}) *vim.is_callable()* Return: ~ (`boolean`) `true` if `f` is callable, else `false` +vim.isarray({t}) *vim.isarray()* + Tests if `t` is an "array": a table indexed only by integers (potentially + non-contiguous). + + If the indexes start from 1 and are contiguous then the array is also a + list. |vim.islist()| + + Empty table `{}` is an array, unless it was created by |vim.empty_dict()| + or returned as a dict-like |API| or Vimscript result, for example from + |rpcrequest()| or |vim.fn|. + + Parameters: ~ + • {t} (`table?`) + + Return: ~ + (`boolean`) `true` if array-like table, else `false`. + + See also: ~ + • https://github.com/openresty/luajit2#tableisarray + vim.islist({t}) *vim.islist()* Tests if `t` is a "list": a table indexed only by contiguous integers starting from 1 (what |lua-length| calls a "regular array"). @@ -2044,7 +2064,7 @@ vim.islist({t}) *vim.islist()* (`boolean`) `true` if list-like table, else `false`. See also: ~ - • |vim.tbl_isarray()| + • |vim.isarray()| vim.list_contains({t}, {value}) *vim.list_contains()* Checks if a list-like table (integer keys without gaps) contains `value`. @@ -2296,26 +2316,6 @@ vim.tbl_get({o}, {...}) *vim.tbl_get()* Return: ~ (`any`) Nested value indexed by key (if it exists), else nil -vim.tbl_isarray({t}) *vim.tbl_isarray()* - Tests if `t` is an "array": a table indexed only by integers (potentially - non-contiguous). - - If the indexes start from 1 and are contiguous then the array is also a - list. |vim.islist()| - - Empty table `{}` is an array, unless it was created by |vim.empty_dict()| - or returned as a dict-like |API| or Vimscript result, for example from - |rpcrequest()| or |vim.fn|. - - Parameters: ~ - • {t} (`table`) - - Return: ~ - (`boolean`) `true` if array-like table, else `false`. - - See also: ~ - • https://github.com/openresty/luajit2#tableisarray - vim.tbl_isempty({t}) *vim.tbl_isempty()* Checks if a table is empty. diff --git a/runtime/doc/news.txt b/runtime/doc/news.txt index ed7da4f9de..025af14954 100644 --- a/runtime/doc/news.txt +++ b/runtime/doc/news.txt @@ -25,7 +25,7 @@ The following changes may require adaptations in user config or plugins. • |vim.islist()| now checks whether a table is actually list-like (i.e., has integer keys without gaps and starting from 1). For the previous behavior (only check for integer keys, allow gaps or not starting with 1), - use |vim.tbl_isarray()|. + use |vim.isarray()|. • "#" followed by a digit no longer stands for a function key at the start of the lhs of a mapping. @@ -155,7 +155,7 @@ unreleased features on Nvim HEAD. • Removed vim.iter.map(), vim.iter.filter(), vim.iter.totable(). -• Renamed vim.tbl_islist() to vim.islist(). +• Renamed vim.tbl_isarray() to vim.isarray(). ============================================================================== NEW FEATURES *news-features* @@ -563,7 +563,7 @@ release. populated. Background color detection is now performed in Lua by the Nvim core, not the TUI. -• vim.shared functions: +• Lua stdlib: - |vim.tbl_add_reverse_lookup()| - |vim.tbl_islist()| -- cgit