summaryrefslogtreecommitdiff
path: root/plugins/MirLua/src/m_core.cpp
diff options
context:
space:
mode:
authorAlexander Lantsev <aunsane@gmail.com>2015-10-26 20:06:26 +0000
committerAlexander Lantsev <aunsane@gmail.com>2015-10-26 20:06:26 +0000
commit2990dd9600121101a2149b4fcb35a614693c8328 (patch)
tree3b93ad624bae56895857ac9ab54776609600ea10 /plugins/MirLua/src/m_core.cpp
parent222cd09a54fa24a87614addbc6f68781f5344299 (diff)
git-svn-id: http://svn.miranda-ng.org/main/trunk@15620 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/MirLua/src/m_core.cpp')
-rw-r--r--plugins/MirLua/src/m_core.cpp19
1 files changed, 19 insertions, 0 deletions
diff --git a/plugins/MirLua/src/m_core.cpp b/plugins/MirLua/src/m_core.cpp
index b3c5afc73f..698eacffa3 100644
--- a/plugins/MirLua/src/m_core.cpp
+++ b/plugins/MirLua/src/m_core.cpp
@@ -177,6 +177,23 @@ static int lua_CallService(lua_State *L)
return 1;
}
+static int lua_IsPluginLoaded(lua_State *L)
+{
+ const char *value = luaL_checkstring(L, 1);
+
+ MUUID uuid = { 0 };
+ int res = sscanf_s(value, "{%08lX-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X}",
+ &uuid.a, &uuid.b, &uuid.c, &uuid.d[0], &uuid.d[1], &uuid.d[2], &uuid.d[3], &uuid.d[4], &uuid.d[5], &uuid.d[6], &uuid.d[7]);
+ if (res == 11)
+ {
+ res = ::IsPluginLoaded(uuid);
+ }
+ lua_pushboolean(L, res);
+
+ return 1;
+}
+
+
static int lua_Utf8DecodeA(lua_State *L)
{
return luaM_toansi(L);
@@ -244,6 +261,8 @@ luaL_Reg coreApi[] =
{ "ServiceExists", lua_ServiceExists },
{ "CallService", lua_CallService },
+ { "IsPluginLoaded", lua_IsPluginLoaded },
+
{ "Utf8DecodeA", lua_Utf8DecodeA },
{ "Utf8DecodeW", lua_Utf8DecodeW },