summaryrefslogtreecommitdiff
path: root/plugins/MirLua/src/m_core.cpp
diff options
context:
space:
mode:
authorAlexander Lantsev <aunsane@gmail.com>2015-07-07 13:49:53 +0000
committerAlexander Lantsev <aunsane@gmail.com>2015-07-07 13:49:53 +0000
commit579b92a2f091284839bfa112116ed088dd3b2418 (patch)
treebb17a0226477f5aacb2d0caf5e5b1ec01f91342c /plugins/MirLua/src/m_core.cpp
parenta6849e6952b88ca67f2eac3f1e2adc287246b0a5 (diff)
MirLua:
- added Utf8DecodeA, Utf8DecodeW and Free to m - more correct number to boolean in m_genmenu - version bump git-svn-id: http://svn.miranda-ng.org/main/trunk@14505 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/MirLua/src/m_core.cpp')
-rw-r--r--plugins/MirLua/src/m_core.cpp35
1 files changed, 35 insertions, 0 deletions
diff --git a/plugins/MirLua/src/m_core.cpp b/plugins/MirLua/src/m_core.cpp
index c9eec524c7..2a5564a07b 100644
--- a/plugins/MirLua/src/m_core.cpp
+++ b/plugins/MirLua/src/m_core.cpp
@@ -160,6 +160,36 @@ static int lua_CallService(lua_State *L)
return 1;
}
+static int lua_Utf8DecodeA(lua_State *L)
+{
+ const char *string = luaL_checkstring(L, 1);
+
+ char *res = mir_utf8decodeA(string);
+ lua_pushlightuserdata(L, res);
+
+ return 1;
+}
+
+static int lua_Utf8DecodeW(lua_State *L)
+{
+ const char *string = luaL_checkstring(L, 1);
+
+ wchar_t *res = mir_utf8decodeW(string);
+ lua_pushlightuserdata(L, res);
+
+ return 1;
+}
+
+static int lua_Free(lua_State *L)
+{
+ luaL_checktype(L, 1, LUA_TLIGHTUSERDATA);
+ void *ptr = lua_touserdata(L, 1);
+
+ mir_free(ptr);
+
+ return 0;
+}
+
static int lua_Translate(lua_State *L)
{
char *what = (char*)luaL_checkstring(L, 1);
@@ -196,6 +226,11 @@ luaL_Reg coreApi[] =
{ "ServiceExists", lua_ServiceExists },
{ "CallService", lua_CallService },
+ { "Utf8DecodeA", lua_Utf8DecodeA },
+ { "Utf8DecodeW", lua_Utf8DecodeW },
+
+ { "Free", lua_Free },
+
{ "Translate", lua_Translate },
{ "ReplaceVariables", lua_ReplaceVariables },