From 50b6a5ca2c5652fdf4e5fab69d9918c0f633cfb5 Mon Sep 17 00:00:00 2001 From: Alexander Lantsev Date: Thu, 23 Jun 2016 13:01:49 +0000 Subject: MirLua: reworked m_core and CMLuaScript git-svn-id: http://svn.miranda-ng.org/main/trunk@17023 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- .../MirLua/Modules/m_msg_buttonsbar/src/main.cpp | 23 +++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) (limited to 'plugins/MirLua/Modules/m_msg_buttonsbar/src') diff --git a/plugins/MirLua/Modules/m_msg_buttonsbar/src/main.cpp b/plugins/MirLua/Modules/m_msg_buttonsbar/src/main.cpp index de2fbdc021..004eee6b87 100644 --- a/plugins/MirLua/Modules/m_msg_buttonsbar/src/main.cpp +++ b/plugins/MirLua/Modules/m_msg_buttonsbar/src/main.cpp @@ -36,14 +36,14 @@ static int lua_AddButton(lua_State *L) { if (lua_type(L, 1) != LUA_TTABLE) { - lua_pushlightuserdata(L, 0); + lua_pushboolean(L, false); return 1; } - BBButton* bbb = MakeBBButton(L); + BBButton *bbb = MakeBBButton(L); INT_PTR res = CallService(MS_BB_ADDBUTTON, 0, (LPARAM)bbb); - lua_pushinteger(L, res); + lua_pushboolean(L, !res); return 1; } @@ -52,14 +52,14 @@ static int lua_ModifyButton(lua_State *L) { if (lua_type(L, 1) != LUA_TTABLE) { - lua_pushlightuserdata(L, 0); + lua_pushboolean(L, false); return 1; } - BBButton* bbb = MakeBBButton(L); + BBButton *bbb = MakeBBButton(L); INT_PTR res = CallService(MS_BB_MODIFYBUTTON, 0, (LPARAM)bbb); - lua_pushinteger(L, res); + lua_pushboolean(L, !res); mir_free(bbb->pszModuleName); mir_free(bbb->ptszTooltip); @@ -70,14 +70,15 @@ static int lua_ModifyButton(lua_State *L) static int lua_RemoveButton(lua_State *L) { - ptrA szModuleName(mir_utf8decodeA(luaL_checkstring(L, 1))); + ptrA module(mir_utf8decodeA(luaL_checkstring(L, 1))); + int buttonId = luaL_checkinteger(L, 2); BBButton mbb = { sizeof(BBButton) }; - mbb.pszModuleName = szModuleName; - mbb.dwButtonID = luaL_checkinteger(L, 2); + mbb.pszModuleName = module; + mbb.dwButtonID = buttonId; - INT_PTR res = ::CallService(MS_BB_REMOVEBUTTON, 0, (LPARAM)&mbb); - lua_pushinteger(L, res); + INT_PTR res = CallService(MS_BB_REMOVEBUTTON, 0, (LPARAM)&mbb); + lua_pushboolean(L, !res); return 1; } -- cgit v1.2.3