Skip to content

Commit 02599f6

Browse files
committed
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
1 parent f7deeb8 commit 02599f6

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

doc/reference/reference_lua/key_def.rst

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,15 @@ to extract or compare the index key values.
3838

3939
Example: ``key_def.new({{type = 'string', collation = 'unicode', field = 2}})``
4040

41+
You can use the standard lua operator ``#`` (__len metamethod) to check the ``key_def`` length (parts count).
42+
43+
**Example**
44+
45+
.. code-block:: lua
46+
47+
function is_full_pkey(space, key)
48+
return #space.index[0].parts == #key
49+
end
4150
4251
.. _key_def-object:
4352

0 commit comments

Comments
 (0)