summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorAlexander Lantsev <aunsane@gmail.com>2015-06-22 14:50:15 +0000
committerAlexander Lantsev <aunsane@gmail.com>2015-06-22 14:50:15 +0000
commitf84128a1886b1154beff66cf13314bdfc412bed0 (patch)
tree2958c1ed544c2d61cb1bc3d2bb990d8109bcbce1 /plugins
parent631e22caadf37a547bafccc0f90251621b0bd987 (diff)
MirLua: added logging to scripts loader
git-svn-id: http://svn.miranda-ng.org/main/trunk@14329 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins')
-rw-r--r--plugins/MirLua/src/mlua.cpp7
-rw-r--r--plugins/MirLua/src/mlua_script_loader.cpp5
-rw-r--r--plugins/MirLua/src/mlua_script_loader.h1
3 files changed, 10 insertions, 3 deletions
diff --git a/plugins/MirLua/src/mlua.cpp b/plugins/MirLua/src/mlua.cpp
index c90d120006..c73d259cf9 100644
--- a/plugins/MirLua/src/mlua.cpp
+++ b/plugins/MirLua/src/mlua.cpp
@@ -2,12 +2,16 @@
CMLua::CMLua() : L(NULL)
{
+ console = new CMLuaConsole(L);
+
Load();
}
CMLua::~CMLua()
{
Unload();
+
+ delete console;
}
void CMLua::Load()
@@ -25,15 +29,12 @@ void CMLua::Load()
MUUID muidLast = MIID_LAST;
hScriptsLangpack = GetPluginLangId(muidLast, 0);
- console = new CMLuaConsole(L);
-
CLuaModuleLoader::Load(L);
CLuaScriptLoader::Load(L);
}
void CMLua::Unload()
{
- delete console;
if (L)
lua_close(L);
KillModuleMenus(hScriptsLangpack);
diff --git a/plugins/MirLua/src/mlua_script_loader.cpp b/plugins/MirLua/src/mlua_script_loader.cpp
index 4ea6c73f80..dc64e2215a 100644
--- a/plugins/MirLua/src/mlua_script_loader.cpp
+++ b/plugins/MirLua/src/mlua_script_loader.cpp
@@ -2,6 +2,7 @@
CLuaScriptLoader::CLuaScriptLoader(lua_State *L) : L(L)
{
+ hLogger = mir_createLog(MODULE, _T("MirLua script loader log"), VARST(_T("%miranda_logpath%\\MirLua.txt")), 0);
}
void CLuaScriptLoader::RegisterScriptsFolder(const char *path)
@@ -18,7 +19,11 @@ void CLuaScriptLoader::RegisterScriptsFolder(const char *path)
void CLuaScriptLoader::LoadScript(const char *path)
{
if (luaL_dofile(L, path))
+ {
+ const char *error = lua_tostring(L, -1);
+ mir_writeLogT(hLogger, _T("%s"), ptrT(mir_utf8decodeT(error)));
printf("%s\n", lua_tostring(L, -1));
+ }
}
void CLuaScriptLoader::LoadScripts(const TCHAR *scriptDir)
diff --git a/plugins/MirLua/src/mlua_script_loader.h b/plugins/MirLua/src/mlua_script_loader.h
index 0d62e86ffc..c2f64a36b8 100644
--- a/plugins/MirLua/src/mlua_script_loader.h
+++ b/plugins/MirLua/src/mlua_script_loader.h
@@ -5,6 +5,7 @@ class CLuaScriptLoader
{
private:
lua_State *L;
+ HANDLE hLogger;
CLuaScriptLoader(lua_State *L);