summaryrefslogtreecommitdiffstats
path: root/src/lua
diff options
context:
space:
mode:
Diffstat (limited to 'src/lua')
-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 */