diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2015-04-07 18:20:45 +0100 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2015-04-07 18:20:45 +0100 |
commit | 0ae6d8f0d0f16466121c66627afe299555fccb3a (patch) | |
tree | ebfe2199cf72d1d657c71e44a66505fd64635cc8 | |
parent | 75a8e1fa3713588d723e05b92686346333800f78 (diff) | |
download | rspamd-0ae6d8f0d0f16466121c66627afe299555fccb3a.tar.gz rspamd-0ae6d8f0d0f16466121c66627afe299555fccb3a.zip |
Indicies in lua starts from 1.
-rw-r--r-- | src/lua/lua_trie.c | 2 | ||||
-rw-r--r-- | test/lua/unit/trie.lua | 6 |
2 files changed, 4 insertions, 4 deletions
diff --git a/src/lua/lua_trie.c b/src/lua/lua_trie.c index 3a07fa3b1..35abdff3d 100644 --- a/src/lua/lua_trie.c +++ b/src/lua/lua_trie.c @@ -134,7 +134,7 @@ lua_trie_callback (int strnum, int textpos, void *context) /* Function */ lua_pushvalue (L, 3); - lua_pushnumber (L, strnum); + lua_pushnumber (L, strnum + 1); lua_pushnumber (L, textpos); if (lua_pcall (L, 2, 1, 0) != 0) { diff --git a/test/lua/unit/trie.lua b/test/lua/unit/trie.lua index 6fa7573f9..5191d9e26 100644 --- a/test/lua/unit/trie.lua +++ b/test/lua/unit/trie.lua @@ -16,10 +16,10 @@ context("Trie search functions", function() assert_not_nil(trie, "cannot create trie") local cases = { - {'test', true, {{4, 0}, {4, 1}}}, - {'she test test', true, {{3, 3}, {3, 2}, {8, 0}, {8, 1}, {13, 0}, {13, 1}}}, + {'test', true, {{4, 1}, {4, 2}}}, + {'she test test', true, {{3, 4}, {3, 3}, {8, 1}, {8, 2}, {13, 1}, {13, 2}}}, {'non-existent', false}, - {'str\0ing test', true, {{7, 4}, {12, 0}, {12, 1}}}, + {'str\0ing test', true, {{7, 5}, {12, 1}, {12, 2}}}, } local function comparetables(t1, t2) |