From 2481102c6541df37a773569dd4d67b579f04d819 Mon Sep 17 00:00:00 2001 From: Alexander Lantsev Date: Thu, 2 Jul 2015 08:52:29 +0000 Subject: MirLua: - removed console - changed logging (via netlib) - version bump git-svn-id: http://svn.miranda-ng.org/main/trunk@14467 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/MirLua/src/mlua.cpp | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) (limited to 'plugins/MirLua/src/mlua.cpp') diff --git a/plugins/MirLua/src/mlua.cpp b/plugins/MirLua/src/mlua.cpp index 3d0d7f6106..253bd2b64e 100644 --- a/plugins/MirLua/src/mlua.cpp +++ b/plugins/MirLua/src/mlua.cpp @@ -2,24 +2,19 @@ CMLua::CMLua() : L(NULL) { - console = new CMLuaConsole(L); - hLogger = mir_createLog(MODULE, _T("MirLua log"), VARST(_T("%miranda_logpath%\\MirLua.txt")), 0); - Load(); } CMLua::~CMLua() { Unload(); - mir_closeLog(hLogger); - delete console; } void CMLua::Load() { - mir_writeLogT(hLogger, _T("Loading lua engine\n")); + CallService(MS_NETLIB_LOG, (WPARAM)hNetlib, (LPARAM)"Loading lua engine"); L = luaL_newstate(); - mir_writeLogT(hLogger, _T("Loading std modules\n")); + CallService(MS_NETLIB_LOG, (WPARAM)hNetlib, (LPARAM)"Loading std modules"); luaL_openlibs(L); lua_getglobal(L, "package"); @@ -29,17 +24,24 @@ void CMLua::Load() lua_setfield(L, -2, "cpath"); lua_pop(L, 1); + lua_getglobal(L, "_G"); + lua_pushcclosure(L, luaM_print, 0); + lua_setfield(L, -2, "print"); + lua_pop(L, 1); + + lua_atpanic(L, luaM_atpanic); + MUUID muidLast = MIID_LAST; hScriptsLangpack = GetPluginLangId(muidLast, 0); - mir_writeLogT(hLogger, _T("Loading miranda modules\n")); + CallService(MS_NETLIB_LOG, (WPARAM)hNetlib, (LPARAM)"Loading miranda modules"); CLuaModuleLoader::Load(L); - CLuaScriptLoader::Load(L, hLogger); + CLuaScriptLoader::Load(L); } void CMLua::Unload() { - mir_writeLogT(hLogger, _T("Unloading lua engine\n")); + CallService(MS_NETLIB_LOG, (WPARAM)hNetlib, (LPARAM)"Unloading lua engine"); ::KillModuleMenus(hScriptsLangpack); ::KillModuleServices(); @@ -66,11 +68,9 @@ int CMLua::HookEventObjParam(void *obj, WPARAM wParam, LPARAM lParam, LPARAM par lua_pushnumber(L, wParam); lua_pushnumber(L, lParam); if (lua_pcall(L, 2, 1, 0)) - printf("%s\n", lua_tostring(L, -1)); + CallService(MS_NETLIB_LOG, (WPARAM)hNetlib, (LPARAM)lua_tostring(L, -1)); int res = (int)lua_tointeger(L, 1); - //luaL_unref(L, LUA_REGISTRYINDEX, ref); - return res; } \ No newline at end of file -- cgit v1.2.3