From 02599f6935e1446827274f83de7f47797441ac9b Mon Sep 17 00:00:00 2001 From: "a.ardeev" Date: Fri, 23 May 2025 18:46:45 +0300 Subject: [PATCH 1/2] Adds description of the ```#``` lua operator usage to key_def Standard lua operator ``#`` (__len metamethod) can be used to check the ``key_def`` length (parts count) Fixes #4275 --- doc/reference/reference_lua/key_def.rst | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/doc/reference/reference_lua/key_def.rst b/doc/reference/reference_lua/key_def.rst index d84369e94b..0a1940fff3 100644 --- a/doc/reference/reference_lua/key_def.rst +++ b/doc/reference/reference_lua/key_def.rst @@ -38,6 +38,15 @@ to extract or compare the index key values. Example: ``key_def.new({{type = 'string', collation = 'unicode', field = 2}})`` + You can use the standard lua operator ``#`` (__len metamethod) to check the ``key_def`` length (parts count). + + **Example** + + .. code-block:: lua + + function is_full_pkey(space, key) + return #space.index[0].parts == #key + end .. _key_def-object: From 043adf8c99bc129fac6b898869447414da4252aa Mon Sep 17 00:00:00 2001 From: "a.ardeev" Date: Fri, 23 May 2025 19:09:57 +0300 Subject: [PATCH 2/2] Adds version mentioning --- doc/reference/reference_lua/key_def.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/reference/reference_lua/key_def.rst b/doc/reference/reference_lua/key_def.rst index 0a1940fff3..0b105c5564 100644 --- a/doc/reference/reference_lua/key_def.rst +++ b/doc/reference/reference_lua/key_def.rst @@ -38,7 +38,7 @@ to extract or compare the index key values. Example: ``key_def.new({{type = 'string', collation = 'unicode', field = 2}})`` - You can use the standard lua operator ``#`` (__len metamethod) to check the ``key_def`` length (parts count). + Since version :doc:`3.2.0 `, you can use the standard lua operator ``#`` (__len metamethod) to check the ``key_def`` length (parts count). **Example**