diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2020-04-30 12:46:51 +0100 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2020-04-30 12:46:51 +0100 |
commit | 9ce6af13789d36a43b4f3170969902d7f2c4f2cc (patch) | |
tree | 7bc27ffddf78ac78d8ea3516f86b49465614465f /src/lua | |
parent | 1f68d27762293d8de8953981b75af90729b7bc30 (diff) | |
download | rspamd-9ce6af13789d36a43b4f3170969902d7f2c4f2cc.tar.gz rspamd-9ce6af13789d36a43b4f3170969902d7f2c4f2cc.zip |
[Minor] Lua_text: Add cookie for metatable
Diffstat (limited to 'src/lua')
-rw-r--r-- | src/lua/lua_text.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/lua/lua_text.c b/src/lua/lua_text.c index d0cc63134..e23eed8cb 100644 --- a/src/lua/lua_text.c +++ b/src/lua/lua_text.c @@ -1200,10 +1200,16 @@ lua_text_oneline (lua_State *L) return 1; } +/* Used to distinguish lua text metatable */ +static const guint rspamd_lua_text_cookie = 0x2b21ef6fU; + static gint lua_load_text (lua_State * L) { lua_newtable (L); + lua_pushstring (L, "cookie"); + lua_pushnumber (L, rspamd_lua_text_cookie); + lua_settable (L, -3); luaL_register (L, NULL, textlib_f); return 1; @@ -1213,6 +1219,9 @@ void luaopen_text (lua_State *L) { rspamd_lua_new_class (L, "rspamd{text}", textlib_m); + lua_pushstring (L, "cookie"); + lua_pushnumber (L, rspamd_lua_text_cookie); + lua_settable (L, -3); lua_pop (L, 1); rspamd_lua_add_preload (L, "rspamd_text", lua_load_text); |