From 61d435a8d120696a280db97bc28ceda3ae6d9781 Mon Sep 17 00:00:00 2001 From: Vsevolod Stakhov Date: Thu, 5 Sep 2019 17:29:52 +0100 Subject: [PATCH] [Minor] Lua_text: Allow to create non owning texts --- src/lua/lua_text.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/lua/lua_text.c b/src/lua/lua_text.c index 2de05e4b1..a41775230 100644 --- a/src/lua/lua_text.c +++ b/src/lua/lua_text.c @@ -139,11 +139,16 @@ lua_text_fromstring (lua_State *L) LUA_TRACE_POINT; const gchar *str; gsize l = 0; + gboolean transparent = FALSE; str = luaL_checklstring (L, 1, &l); if (str) { - lua_new_text (L, str, l, RSPAMD_TEXT_FLAG_OWN); + if (lua_isboolean (L, 2)) { + transparent = lua_toboolean (L, 2); + } + + lua_new_text (L, str, l, transparent ? 0 : RSPAMD_TEXT_FLAG_OWN); } else { return luaL_error (L, "invalid arguments"); -- 2.39.5