diff options
| author | Alexander Lantsev <aunsane@gmail.com> | 2015-06-10 13:43:07 +0000 |
|---|---|---|
| committer | Alexander Lantsev <aunsane@gmail.com> | 2015-06-10 13:43:07 +0000 |
| commit | 22ecdc28ebf053a6b335b802949f4f774af97d26 (patch) | |
| tree | 980abced379dcc5a3c0021eac4ccdd20358387bc /plugins/MirLua/src/mlua_core.cpp | |
| parent | 61eb66b5f8be46f1e5fe148aefb0364e3ceb9d59 (diff) | |
MirLua:
- removed unwanted paths to script searching
- fixed crash on event hook/service call
- code cleanup
git-svn-id: http://svn.miranda-ng.org/main/trunk@14103 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/MirLua/src/mlua_core.cpp')
| -rw-r--r-- | plugins/MirLua/src/mlua_core.cpp | 26 |
1 files changed, 11 insertions, 15 deletions
diff --git a/plugins/MirLua/src/mlua_core.cpp b/plugins/MirLua/src/mlua_core.cpp index cb80255eb7..7e26e8b354 100644 --- a/plugins/MirLua/src/mlua_core.cpp +++ b/plugins/MirLua/src/mlua_core.cpp @@ -41,10 +41,12 @@ static int HookEventObjParam(void *obj, WPARAM wParam, LPARAM lParam, LPARAM par lua_pushnumber(L, wParam);
lua_pushnumber(L, lParam);
- lua_call(L, 2, 1);
- int res = (int)luaL_checkinteger(L, 1);
+ if(lua_pcall(L, 2, 1, 0))
+ printf("%s\n", lua_tostring(L, -1));
+
+ int res = (int)lua_tointeger(L, 1);
- luaL_unref(L, LUA_REGISTRYINDEX, ref);
+ //luaL_unref(L, LUA_REGISTRYINDEX, ref);
return res;
}
@@ -81,10 +83,12 @@ static INT_PTR ServiceFunctionObjParam(void *obj, WPARAM wParam, LPARAM lParam, lua_pushnumber(L, wParam);
lua_pushnumber(L, lParam);
- lua_call(L, 2, 1);
- INT_PTR res = (INT_PTR)luaL_checkinteger(L, 1);
+ if (lua_pcall(L, 2, 1, 0))
+ printf("%s\n", lua_tostring(L, -1));
- luaL_unref(L, LUA_REGISTRYINDEX, ref);
+ INT_PTR res = (INT_PTR)lua_tointeger(L, 1);
+
+ //luaL_unref(L, LUA_REGISTRYINDEX, ref);
return res;
}
@@ -135,7 +139,7 @@ static int lua_CallService(lua_State *L) return 1;
}
-static luaL_Reg coreLib[] =
+luaL_Reg CMLua::coreLib[] =
{
{ "CreateHookableEvent", lua_CreateHookableEvent },
{ "DestroyHookableEvent", lua_DestroyHookableEvent },
@@ -153,11 +157,3 @@ static luaL_Reg coreLib[] = { NULL, NULL }
};
-
-int CMLua::luaopen_m(lua_State *L)
-{
- luaL_newlib(L, coreLib);
- lua_setglobal(L, "M");
-
- return 1;
-}
|
