Skip to content

Commit 542a4d2

Browse files
authored
Adds description of the # lua operator usage to key_def (#5129)
* 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 28f1245 commit 542a4d2

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+
Since version :doc:`3.2.0 </release/3.2.0>`, 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)