From 47e625600edb15d4b3c7b16b970708de9fff2019 Mon Sep 17 00:00:00 2001
From: Dmitry Simonenko <pmwkaa@gmail.com>
Date: Wed, 7 Mar 2012 17:42:39 +0400
Subject: [PATCH] box-lua: box.select_limit function added

---
 mod/box/box.lua | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/mod/box/box.lua b/mod/box/box.lua
index 8045fb5201..0ca9ec380b 100644
--- a/mod/box/box.lua
+++ b/mod/box/box.lua
@@ -1,3 +1,20 @@
+
+--
+--
+--
+function box.select_limit(space, index, offset, limit, ...)
+    local key = {...}
+    return box.process(17,
+                       box.pack('iiiiii'..string.rep('p', #key),
+                                 space,
+                                 index,
+                                 offset,
+                                 limit,
+                                 1, -- key count
+                                 #key, -- key cardinality
+                                 unpack(key)))
+end
+
 --
 --
 --
@@ -105,6 +122,9 @@ function box.on_reload_configuration()
     space_mt.select_range = function(space, ino, limit, ...)
         return space.index[ino]:select_range(limit, ...)
     end
+    space_mt.select_limit = function(space, ino, offset, limit, ...)
+	return box.select_limit(space.n, ino, offset, limit, ...)
+    end
     space_mt.insert = function(space, ...) return box.insert(space.n, ...) end
     space_mt.update = function(space, ...) return box.update(space.n, ...) end
     space_mt.replace = function(space, ...) return box.replace(space.n, ...) end
-- 
GitLab