diff options
author | Alexander Lantsev <aunsane@gmail.com> | 2015-07-02 08:52:29 +0000 |
---|---|---|
committer | Alexander Lantsev <aunsane@gmail.com> | 2015-07-02 08:52:29 +0000 |
commit | 2481102c6541df37a773569dd4d67b579f04d819 (patch) | |
tree | c8dac50aac18414c42e8c024340eab7a6ee5ab32 /plugins/MirLua/src/mlua_script_loader.cpp | |
parent | cea0c911bc4bb8d527739cbaf1a098ac2344a7d8 (diff) |
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
Diffstat (limited to 'plugins/MirLua/src/mlua_script_loader.cpp')
-rw-r--r-- | plugins/MirLua/src/mlua_script_loader.cpp | 29 |
1 files changed, 16 insertions, 13 deletions
diff --git a/plugins/MirLua/src/mlua_script_loader.cpp b/plugins/MirLua/src/mlua_script_loader.cpp index 663ad4cd59..c54c489d8b 100644 --- a/plugins/MirLua/src/mlua_script_loader.cpp +++ b/plugins/MirLua/src/mlua_script_loader.cpp @@ -1,6 +1,6 @@ #include "stdafx.h"
-CLuaScriptLoader::CLuaScriptLoader(lua_State *L, HANDLE hLogger) : L(L), hLogger(hLogger)
+CLuaScriptLoader::CLuaScriptLoader(lua_State *L) : L(L)
{
}
@@ -18,20 +18,26 @@ void CLuaScriptLoader::RegisterScriptsFolder(const char *path) lua_pop(L, 1);
}
-void CLuaScriptLoader::LoadScript(const TCHAR *path, const TCHAR *name)
+void CLuaScriptLoader::LoadScript(const TCHAR *path)
{
+
if (luaL_dofile(L, T2Utf(path)))
{
- ptrT error(mir_utf8decodeT(lua_tostring(L, -1)));
- mir_writeLogT(hLogger, _T(" %s:FAIL\n %s\n"), name, error);
- printf("%s\n", lua_tostring(L, -1));
+ CallService(MS_NETLIB_LOG, (WPARAM)hNetlib, (LPARAM)lua_tostring(L, -1));
+ return;
}
- else mir_writeLogT(hLogger, _T(" %s:OK\n"), name);
+
+ TCHAR buf[4096];
+ mir_sntprintf(buf, _T("%s:OK"), path);
+ CallService(MS_NETLIB_LOGW, (WPARAM)hNetlib, (LPARAM)buf);
}
void CLuaScriptLoader::LoadScripts(const TCHAR *scriptDir)
{
- mir_writeLogT(hLogger, _T("Loading scripts from path %s\n"), scriptDir);
+ TCHAR buf[4096];
+ mir_sntprintf(buf, _T("Loading scripts from %s"), scriptDir);
+ CallService(MS_NETLIB_LOGW, (WPARAM)hNetlib, (LPARAM)buf);
+
RegisterScriptsFolder(ptrA(mir_utf8encodeT(scriptDir)));
TCHAR searchMask[MAX_PATH];
@@ -50,24 +56,21 @@ void CLuaScriptLoader::LoadScripts(const TCHAR *scriptDir) mir_sntprintf(fullPath, _T("%s\\%s"), scriptDir, fd.cFileName);
PathToRelativeT(fullPath, path);
if (db_get_b(NULL, MODULE, _T2A(fd.cFileName), 1))
- LoadScript(fullPath, fd.cFileName);
+ LoadScript(fullPath);
}
} while (FindNextFile(hFind, &fd));
FindClose(hFind);
}
- mir_writeLogT(hLogger, _T("\n"), scriptDir);
}
-void CLuaScriptLoader::Load(lua_State *L, HANDLE hLogger)
+void CLuaScriptLoader::Load(lua_State *L)
{
TCHAR scriptDir[MAX_PATH];
- CLuaScriptLoader loader(L, hLogger);
+ CLuaScriptLoader loader(L);
FoldersGetCustomPathT(g_hCommonFolderPath, scriptDir, _countof(scriptDir), VARST(COMMON_SCRIPTS_PATHT));
loader.LoadScripts(scriptDir);
FoldersGetCustomPathT(g_hCustomFolderPath, scriptDir, _countof(scriptDir), VARST(CUSTOM_SCRIPTS_PATHT));
loader.LoadScripts(scriptDir);
-
- mir_writeLogT(hLogger, _T("\n"), scriptDir);
}
\ No newline at end of file |