From 932f5569c467683d3b95c45772da903d3117dc11 Mon Sep 17 00:00:00 2001 From: Alexander Lantsev Date: Sun, 21 Jun 2015 20:38:33 +0000 Subject: MirLua: some changes git-svn-id: http://svn.miranda-ng.org/main/trunk@14311 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/MirLua/src/mlua_utils.cpp | 43 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 plugins/MirLua/src/mlua_utils.cpp (limited to 'plugins/MirLua/src/mlua_utils.cpp') diff --git a/plugins/MirLua/src/mlua_utils.cpp b/plugins/MirLua/src/mlua_utils.cpp new file mode 100644 index 0000000000..aab6823b85 --- /dev/null +++ b/plugins/MirLua/src/mlua_utils.cpp @@ -0,0 +1,43 @@ +#include "stdafx.h" + +WPARAM luaM_towparam(lua_State *L, int idx) +{ + WPARAM wParam = NULL; + switch (lua_type(L, idx)) + { + case LUA_TBOOLEAN: + wParam = lua_toboolean(L, idx); + break; + case LUA_TNUMBER: + wParam = lua_tonumber(L, idx); + break; + case LUA_TSTRING: + wParam = (LPARAM)mir_utf8decode((char*)lua_tostring(L, idx), NULL); + break; + case LUA_TUSERDATA: + wParam = (WPARAM)lua_touserdata(L, idx); + break; + } + return wParam; +} + +LPARAM luaM_tolparam(lua_State *L, int idx) +{ + LPARAM lParam = NULL; + switch (lua_type(L, idx)) + { + case LUA_TBOOLEAN: + lParam = lua_toboolean(L, idx); + break; + case LUA_TNUMBER: + lParam = lua_tonumber(L, idx); + break; + case LUA_TSTRING: + lParam = (LPARAM)mir_utf8decode((char*)lua_tostring(L, idx), NULL); + break; + case LUA_TUSERDATA: + lParam = (LPARAM)lua_touserdata(L, idx); + break; + } + return lParam; +} \ No newline at end of file -- cgit v1.2.3