From a8b73eae6cdbe31766cef453755c5abac5526603 Mon Sep 17 00:00:00 2001 From: Ivan Remen Date: Tue, 18 Apr 2017 10:02:23 -0400 Subject: [PATCH] Delfi filters --- delfi.lua | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 delfi.lua diff --git a/delfi.lua b/delfi.lua new file mode 100644 index 0000000..bb2aa96 --- /dev/null +++ b/delfi.lua @@ -0,0 +1,21 @@ +local space_no = 0 + +function find_filters_by_regex(regex) + local cnt = 0 + local t = {} + for tpl in box.space[space_no].index[0]:iterator(box.index.ALL) do + + if string.find(tpl[1], regex) then + local id = box.unpack('i', tpl[0]) + table.insert(t, id) + end + + cnt = cnt + 1 + if cnt == 1000 then + box.fiber.sleep(0) + cnt = 0 + end + end + + return unpack(t) +end