From 6b80e5120a9edeebee4e266fc17c81e2a5ddaf40 Mon Sep 17 00:00:00 2001 From: Vsevolod Stakhov Date: Wed, 1 Sep 2021 13:35:13 +0100 Subject: [Minor] Add function to get a lua_reference from a string returning a function --- src/lua/lua_common.h | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src/lua/lua_common.h') diff --git a/src/lua/lua_common.h b/src/lua/lua_common.h index d9e4fcaec..b929ab864 100644 --- a/src/lua/lua_common.h +++ b/src/lua/lua_common.h @@ -565,6 +565,15 @@ void rspamd_lua_run_config_unload (lua_State *L, struct rspamd_config *cfg); void rspamd_lua_add_ref_dtor (lua_State *L, rspamd_mempool_t *pool, gint ref); +/** + * Returns a lua reference from a function like string, e.g. `return function(...) end` + * @param L + * @param str + * @return + */ +gint rspamd_lua_function_ref_from_str (lua_State *L, const gchar *str, gsize slen, + GError **err); + /** * Tries to load some module using `require` and get some method from it * @param L -- cgit v1.2.3