From 42e279369af861f61b08919650c10749191328cb Mon Sep 17 00:00:00 2001 From: Alexander Lantsev Date: Thu, 11 Jun 2015 21:40:06 +0000 Subject: MirLua: added MirLua: added ReplaceVariables to core module git-svn-id: http://svn.miranda-ng.org/main/trunk@14128 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/MirLua/src/m_core.cpp | 17 ++++++++++++++--- plugins/MirLua/src/mlua.h | 2 +- 2 files changed, 15 insertions(+), 4 deletions(-) (limited to 'plugins/MirLua') diff --git a/plugins/MirLua/src/m_core.cpp b/plugins/MirLua/src/m_core.cpp index 25d43a4964..e4c90da074 100644 --- a/plugins/MirLua/src/m_core.cpp +++ b/plugins/MirLua/src/m_core.cpp @@ -187,10 +187,20 @@ static int lua_CallService(lua_State *L) static int lua_Translate(lua_State *L) { - char *value = (char*)luaL_checkstring(L, 1); + char *what = (char*)luaL_checkstring(L, 1); - ptrT string(mir_utf8decodeT(value, NULL)); - lua_pushstring(L, T2Utf(TranslateTS(string))); + ptrT value(mir_utf8decodeT(what, NULL)); + lua_pushstring(L, T2Utf(TranslateTS(value))); + + return 1; +} + +static int lua_ReplaceVariables(lua_State *L) +{ + char *what = (char*)luaL_checkstring(L, 1); + + ptrT value(mir_utf8decodeT(what, NULL)); + lua_pushstring(L, T2Utf(VARST(value))); return 1; } @@ -214,6 +224,7 @@ luaL_Reg CMLua::coreLib[] = { "CallService", lua_CallService }, { "Translate", lua_Translate }, + { "ReplaceVariables", lua_ReplaceVariables }, { NULL, NULL } }; diff --git a/plugins/MirLua/src/mlua.h b/plugins/MirLua/src/mlua.h index 3f897e085a..5f061702ae 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[13]; + static luaL_Reg coreLib[14]; void Preload(const char *name, lua_CFunction func); -- cgit v1.2.3