aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2020-08-27 16:23:08 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2020-08-27 16:23:08 +0100
commit1438514d3bf8de013aa311a6b0c6173de63c75e5 (patch)
tree2d7ee52d3e1f724ca39e5168daa890020ecff74b
parentf9ca74c445e4f40e8abbae6ecbfbb6e6181b61ed (diff)
downloadrspamd-1438514d3bf8de013aa311a6b0c6173de63c75e5.tar.gz
rspamd-1438514d3bf8de013aa311a6b0c6173de63c75e5.zip
[Minor] Add proper metamethods for redis.null
-rw-r--r--src/lua/lua_redis.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/lua/lua_redis.c b/src/lua/lua_redis.c
index 9b26f5c7b..8e9e11dda 100644
--- a/src/lua/lua_redis.c
+++ b/src/lua/lua_redis.c
@@ -1666,13 +1666,23 @@ lua_load_redis (lua_State * L)
return 1;
}
+static gint
+lua_redis_null_idx (lua_State *L)
+{
+ lua_pushnil (L);
+
+ return 1;
+}
+
static void
lua_redis_null_mt (lua_State *L)
{
luaL_newmetatable (L, "redis{null}");
- lua_pushinteger (L, 0);
- lua_setfield (L, -2, "cookie");
+ lua_pushcfunction (L, lua_redis_null_idx);
+ lua_setfield (L, -2, "__index");
+ lua_pushcfunction (L, lua_redis_null_idx);
+ lua_setfield (L, -2, "__tostring");
lua_pop (L, 1);
}