From ace0a3fd6e98fb50e038a792eabd3faae13ec166 Mon Sep 17 00:00:00 2001 From: Sadrul Habib Chowdhury Date: Tue, 9 Jun 2009 16:59:28 -0400 Subject: [PATCH] The script decides what value to return to the script system. It might be of interest to let several callback functions to excute for the same event. This change will be necessary for that. --- src/lua.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/lua.c b/src/lua.c index e963c3c..0fa4c06 100644 --- a/src/lua.c +++ b/src/lua.c @@ -814,20 +814,22 @@ static int LuaDispatch(void *handler, const char *params, va_list va) { const char *func = handler; - int argc; + int argc, retvalue; lua_getfield(L, LUA_GLOBALSINDEX, func); if (lua_isnil(L, -1)) return 0; argc = LuaPushParams(L, params, va); - if (lua_pcall(L, argc, 0, 0) == LUA_ERRRUN && lua_isstring(L, -1)) + if (lua_pcall(L, argc, 1, 0) == LUA_ERRRUN && lua_isstring(L, -1)) { StackDump(L, "After LuaDispatch\n"); LuaShowErr(L); return 0; } - return 0; + retvalue = lua_tonumber(L, -1); + lua_pop(L, 1); + return retvalue; } int LuaForeWindowChanged(void) -- 2.11.4.GIT