From a0cef1d43a718ea27333293280347a19a914c9a3 Mon Sep 17 00:00:00 2001 From: Alexander Lantsev Date: Thu, 11 Jun 2015 20:05:07 +0000 Subject: MirLua: added Translate to core module git-svn-id: http://svn.miranda-ng.org/main/trunk@14123 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/MirLua/src/m_core.cpp | 12 ++++++++++++ plugins/MirLua/src/mlua.h | 2 +- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/plugins/MirLua/src/m_core.cpp b/plugins/MirLua/src/m_core.cpp index 99166d3236..25d43a4964 100644 --- a/plugins/MirLua/src/m_core.cpp +++ b/plugins/MirLua/src/m_core.cpp @@ -185,6 +185,16 @@ static int lua_CallService(lua_State *L) return 1; } +static int lua_Translate(lua_State *L) +{ + char *value = (char*)luaL_checkstring(L, 1); + + ptrT string(mir_utf8decodeT(value, NULL)); + lua_pushstring(L, T2Utf(TranslateTS(string))); + + return 1; +} + luaL_Reg CMLua::coreLib[] = { { "CreateHookableEvent", lua_CreateHookableEvent }, @@ -203,5 +213,7 @@ luaL_Reg CMLua::coreLib[] = { "ServiceExists", lua_ServiceExists }, { "CallService", lua_CallService }, + { "Translate", lua_Translate }, + { NULL, NULL } }; diff --git a/plugins/MirLua/src/mlua.h b/plugins/MirLua/src/mlua.h index 8abc839bd0..3f897e085a 100644 --- a/plugins/MirLua/src/mlua.h +++ b/plugins/MirLua/src/mlua.h @@ -5,7 +5,7 @@ class CMLua { private: lua_State *L; - static luaL_Reg coreLib[12]; + static luaL_Reg coreLib[13]; void Preload(const char *name, lua_CFunction func); -- cgit v1.2.3