summaryrefslogtreecommitdiff
path: root/plugins/MirLua
diff options
context:
space:
mode:
authorAlexander Lantsev <aunsane@gmail.com>2015-06-16 15:15:01 +0000
committerAlexander Lantsev <aunsane@gmail.com>2015-06-16 15:15:01 +0000
commit6dc20e70f308daee742372a7978c1f65668186f3 (patch)
tree232e56b9d1c8766221902a946b2cdc63355e0873 /plugins/MirLua
parentc9700c210aa7252faa78af4fbd39a6e0de9f1642 (diff)
MirLua:
- added variables module - strings passed through WPARAM/LPARAM should be ansi git-svn-id: http://svn.miranda-ng.org/main/trunk@14207 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/MirLua')
-rw-r--r--plugins/MirLua/docs/examples/variables.lua5
-rw-r--r--plugins/MirLua/src/m_core.cpp2
-rw-r--r--plugins/MirLua/src/mlua.cpp5
-rw-r--r--plugins/MirLua/src/stdafx.h4
4 files changed, 13 insertions, 3 deletions
diff --git a/plugins/MirLua/docs/examples/variables.lua b/plugins/MirLua/docs/examples/variables.lua
new file mode 100644
index 0000000000..dee0f4f8e0
--- /dev/null
+++ b/plugins/MirLua/docs/examples/variables.lua
@@ -0,0 +1,5 @@
+local vars = require('m_variables')
+
+m.OnModulesLoaded(function()
+ print(vars.FormatString('?add(2,2)'))
+ end)
diff --git a/plugins/MirLua/src/m_core.cpp b/plugins/MirLua/src/m_core.cpp
index df0f502fac..77dab3299d 100644
--- a/plugins/MirLua/src/m_core.cpp
+++ b/plugins/MirLua/src/m_core.cpp
@@ -179,7 +179,7 @@ static int lua_ReplaceVariables(lua_State *L)
{
char *what = (char*)luaL_checkstring(L, 1);
- ptrT value(mir_utf8decodeT(what, NULL));
+ ptrT value(mir_utf8decodeT(what));
lua_pushstring(L, T2Utf(VARST(value)));
return 1;
diff --git a/plugins/MirLua/src/mlua.cpp b/plugins/MirLua/src/mlua.cpp
index e67caf6272..f7b5208ccb 100644
--- a/plugins/MirLua/src/mlua.cpp
+++ b/plugins/MirLua/src/mlua.cpp
@@ -20,6 +20,7 @@ CMLua::CMLua() : L(NULL)
Preload(MLUA_GENMENU, luaopen_m_genmenu);
Preload(MLUA_MSGBUTTONSBAR, luaopen_m_msg_buttonsbar);
Preload(MLUA_TOPTOOLBAR, luaopen_m_toptoolbar);
+ Preload(MLUA_VARIABLES, luaopen_m_variables);
}
CMLua::~CMLua()
@@ -65,7 +66,7 @@ WPARAM CMLua::GetWParam(lua_State *L, int idx)
wParam = lua_tonumber(L, idx);
break;
case LUA_TSTRING:
- wParam = (WPARAM)lua_tostring(L, idx);
+ wParam = (LPARAM)mir_utf8decode((char*)lua_tostring(L, idx), NULL);
break;
case LUA_TUSERDATA:
wParam = (WPARAM)lua_touserdata(L, idx);
@@ -86,7 +87,7 @@ LPARAM CMLua::GetLParam(lua_State *L, int idx)
lParam = lua_tonumber(L, idx);
break;
case LUA_TSTRING:
- lParam = (LPARAM)lua_tostring(L, idx);
+ lParam = (LPARAM)mir_utf8decode((char*)lua_tostring(L, idx), NULL);
break;
case LUA_TUSERDATA:
lParam = (LPARAM)lua_touserdata(L, idx);
diff --git a/plugins/MirLua/src/stdafx.h b/plugins/MirLua/src/stdafx.h
index 26296fedc8..778b6a1185 100644
--- a/plugins/MirLua/src/stdafx.h
+++ b/plugins/MirLua/src/stdafx.h
@@ -19,6 +19,7 @@
#include <m_folders.h>
#include <m_toptoolbar.h>
#include <m_msg_buttonsbar.h>
+#include <m_variables.h>
extern "C"
{
@@ -65,4 +66,7 @@ LUAMOD_API int (luaopen_m_msg_buttonsbar)(lua_State *L);
#define MLUA_TOPTOOLBAR "m_toptoolbar"
LUAMOD_API int (luaopen_m_toptoolbar)(lua_State *L);
+#define MLUA_VARIABLES "m_variables"
+LUAMOD_API int (luaopen_m_variables)(lua_State *L);
+
#endif //_COMMON_H_