From f8b41d51f1b760a433c2dbf997ed852b7dd94945 Mon Sep 17 00:00:00 2001 From: Alexander Lantsev Date: Sun, 3 Jan 2016 21:30:23 +0000 Subject: MirLua: fixed script loading git-svn-id: http://svn.miranda-ng.org/main/trunk@16014 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/MirLua/src/mlua_utils.cpp | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) (limited to 'plugins/MirLua/src/mlua_utils.cpp') diff --git a/plugins/MirLua/src/mlua_utils.cpp b/plugins/MirLua/src/mlua_utils.cpp index 9b5d9ca9ee..d0c89090b3 100644 --- a/plugins/MirLua/src/mlua_utils.cpp +++ b/plugins/MirLua/src/mlua_utils.cpp @@ -1,5 +1,21 @@ #include "stdafx.h" +void Log(const char *format, ...) +{ + va_list args; + va_start(args, format); + CallService(MS_NETLIB_LOG, (WPARAM)hNetlib, (LPARAM)(CMStringA().FormatV(format, args))); + va_end(args); +} + +void Log(const wchar_t *format, ...) +{ + va_list args; + va_start(args, format); + CallService(MS_NETLIB_LOGW, (WPARAM)hNetlib, (LPARAM)(CMStringW().FormatV(format, args))); + va_end(args); +} + void ShowNotification(const char *caption, const char *message, int flags, MCONTACT hContact) { if (Miranda_Terminated()) @@ -21,7 +37,7 @@ void ShowNotification(const char *caption, const char *message, int flags, MCONT void ReportError(const char *message) { - CallService(MS_NETLIB_LOG, (WPARAM)hNetlib, (LPARAM)message); + Log(message); if (db_get_b(NULL, MODULE, "PopupOnError", 0)) ShowNotification(MODULE, message, MB_OK | MB_ICONERROR); } @@ -59,9 +75,6 @@ int luaM_print(lua_State *L) case LUA_TSTRING: data.AppendFormat("%s ", lua_tostring(L, i)); break; - case LUA_TTABLE: - data.AppendFormat("table(0x%p) ", lua_topointer(L, i)); - break; default: data.AppendFormat("%s(0x%p) ", luaL_typename(L, i), lua_topointer(L, i)); break; @@ -70,7 +83,7 @@ int luaM_print(lua_State *L) if (data.GetLength() >= 3) data.Delete(data.GetLength() - 3, 3); - CallService(MS_NETLIB_LOG, (WPARAM)hNetlib, (LPARAM)data.GetBuffer()); + Log(data.GetBuffer()); return 0; } @@ -165,7 +178,7 @@ void ObsoleteMethod(lua_State *L, const char *message) char text[512]; mir_snprintf(text, "%s is obsolete. %s", info.name, message); - CallService(MS_NETLIB_LOG, (WPARAM)hNetlib, (LPARAM)text); + Log(text); if (db_get_b(NULL, MODULE, "PopupOnObsolete", 0)) ShowNotification(MODULE, text, MB_OK | MB_ICONWARNING, NULL); } \ No newline at end of file -- cgit v1.2.3