diff options
-rw-r--r-- | plugins/MirLua/docs/examples/menus.lua | 2 | ||||
-rw-r--r-- | plugins/MirLua/src/m_genmenu.cpp | 15 |
2 files changed, 7 insertions, 10 deletions
diff --git a/plugins/MirLua/docs/examples/menus.lua b/plugins/MirLua/docs/examples/menus.lua index d1adec03d0..67bea59a40 100644 --- a/plugins/MirLua/docs/examples/menus.lua +++ b/plugins/MirLua/docs/examples/menus.lua @@ -54,4 +54,4 @@ local hChild = genmenu.AddMainMenuItem(menuItem) --- Modify menu item local CMIM_NAME = tonumber("80000000", 16) -genmenu.ModifyMenuItem(hChild, { Name = "Main menu child", Flags = CMIM_NAME }) +genmenu.ModifyMenuItem(hChild, "Main menu child", hIcon, CMIM_NAME) diff --git a/plugins/MirLua/src/m_genmenu.cpp b/plugins/MirLua/src/m_genmenu.cpp index 1d03263970..eabc1cef71 100644 --- a/plugins/MirLua/src/m_genmenu.cpp +++ b/plugins/MirLua/src/m_genmenu.cpp @@ -51,7 +51,7 @@ static int lua_AddMainMenuItem(lua_State *L) mir_ptr<TMO_MenuItem> pmi(MakeMenuItem(L));
- HGENMENU res = Menu_AddMainMenuItem(pmi);
+ HGENMENU res = ::Menu_AddMainMenuItem(pmi);
lua_pushlightuserdata(L, res);
return 1;
@@ -67,7 +67,7 @@ static int lua_AddContactMenuItem(lua_State *L) mir_ptr<TMO_MenuItem> pmi(MakeMenuItem(L));
- HGENMENU res = Menu_AddContactMenuItem(pmi);
+ HGENMENU res = ::Menu_AddContactMenuItem(pmi);
lua_pushlightuserdata(L, res);
return 1;
@@ -92,16 +92,13 @@ static int lua_AddTrayMenuItem(lua_State *L) static int lua_ModifyMenuItem(lua_State *L)
{
HGENMENU hMenuItem = (HGENMENU)lua_touserdata(L, 1);
-
- if (lua_type(L, 2) != LUA_TTABLE)
- {
- lua_pushlightuserdata(L, 0);
- return 1;
- }
+ ptrT name(mir_utf8decodeT(luaL_checkstring(L, 2)));
+ HANDLE hIcolibItem = lua_touserdata(L, 3);
+ int flags = lua_tointeger(L, 4);
mir_ptr<TMO_MenuItem> pmi(MakeMenuItem(L));
- INT_PTR res = ::Menu_ModifyItem(hMenuItem, pmi->name.t, pmi->hIcolibItem, pmi->flags);
+ INT_PTR res = ::Menu_ModifyItem(hMenuItem, name, hIcolibItem, flags);
lua_pushinteger(L, res);
return 1;
}
|