summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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);