aboutsummaryrefslogtreecommitdiffstats
path: root/src/lua/lua_cfg_file.c
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@rambler-co.ru>2011-02-08 21:22:58 +0300
committerVsevolod Stakhov <vsevolod@rambler-co.ru>2011-02-08 21:22:58 +0300
commit93a1584882133dc81d46fa8e15943fcab6e8ce3f (patch)
treeedeeb5b812124180cb4f5f130d7aeb6d168d2fe8 /src/lua/lua_cfg_file.c
parentcec24a9efaa5a4dacece6c1ed5a44ac483d83a55 (diff)
downloadrspamd-93a1584882133dc81d46fa8e15943fcab6e8ce3f.tar.gz
rspamd-93a1584882133dc81d46fa8e15943fcab6e8ce3f.zip
Call lua function properly.
Diffstat (limited to 'src/lua/lua_cfg_file.c')
-rw-r--r--src/lua/lua_cfg_file.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/lua/lua_cfg_file.c b/src/lua/lua_cfg_file.c
index a7c48aedf..fca0d0772 100644
--- a/src/lua/lua_cfg_file.c
+++ b/src/lua/lua_cfg_file.c
@@ -125,7 +125,7 @@ lua_process_element (struct config_file *cfg, const gchar *name, struct module_o
opt->lua_type = LUA_VAR_STRING;
break;
case LUA_TFUNCTION:
- opt->actual_data = memory_pool_strdup (cfg->cfg_pool, lua_tostring (L, idx));
+ opt->actual_data = memory_pool_strdup (cfg->cfg_pool, name);
opt->lua_type = LUA_VAR_FUNCTION;
break;
case LUA_TNIL:
@@ -230,12 +230,17 @@ lua_handle_param (struct worker_task *task, gchar *mname, gchar *optname, enum l
/* First check function in config table */
lua_getglobal (L, "config");
if (lua_istable (L, -1)) {
- lua_pushstring (L, opt->actual_data);
+ lua_pushstring (L, mname);
lua_gettable (L, -2);
if (lua_isnil (L, -1)) {
/* Try to get global variable */
lua_getglobal (L, opt->actual_data);
}
+ else {
+ /* Call local function in table */
+ lua_pushstring (L, opt->actual_data);
+ lua_gettable (L, -2);
+ }
}
else {
/* Try to get global variable */