From: Vsevolod Stakhov Date: Thu, 30 Apr 2020 11:46:51 +0000 (+0100) Subject: [Minor] Lua_text: Add cookie for metatable X-Git-Tag: 2.6~470 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=9ce6af13789d36a43b4f3170969902d7f2c4f2cc;p=thirdparty%2Frspamd.git [Minor] Lua_text: Add cookie for metatable --- diff --git a/src/lua/lua_text.c b/src/lua/lua_text.c index d0cc631341..e23eed8cbb 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);