From 68adcd86746d69d04ef38b59ca5955cee467014b Mon Sep 17 00:00:00 2001 From: Alexander Lantsev Date: Sat, 31 Oct 2015 19:54:58 +0000 Subject: MirLua: added CreateRoot to m_genmenu git-svn-id: http://svn.miranda-ng.org/main/trunk@15658 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/MirLua/src/m_database.cpp | 2 +- plugins/MirLua/src/m_genmenu.cpp | 14 ++++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) (limited to 'plugins') diff --git a/plugins/MirLua/src/m_database.cpp b/plugins/MirLua/src/m_database.cpp index a165fed50e..ab9224bb1e 100644 --- a/plugins/MirLua/src/m_database.cpp +++ b/plugins/MirLua/src/m_database.cpp @@ -639,7 +639,7 @@ static int dbei__gc(lua_State *L) mir_free(dbei->pBlob); - return 1; + return 0; } static const luaL_Reg dbeiMeta[] = diff --git a/plugins/MirLua/src/m_genmenu.cpp b/plugins/MirLua/src/m_genmenu.cpp index 1c729c43c9..d47bf7c012 100644 --- a/plugins/MirLua/src/m_genmenu.cpp +++ b/plugins/MirLua/src/m_genmenu.cpp @@ -45,6 +45,19 @@ void MakeMenuItem(lua_State *L, CMenuItem &mi) lua_pop(L, 1); } +static int lua_CreateRoot(lua_State *L) +{ + int hMenuObject = lua_tointeger(L, 1); + const char *name = luaL_checkstring(L, 2); + int position = lua_tointeger(L, 3); + HANDLE hIcon = (HANDLE)lua_touserdata(L, -4); + + HGENMENU res = Menu_CreateRoot(MO_MAIN, ptrT(Utf8DecodeT(name)), position, hIcon); + lua_pushlightuserdata(L, res); + + return 1; +} + static int lua_AddMenuItem(lua_State *L) { int hMenuObject = lua_tointeger(L, 1); @@ -121,6 +134,7 @@ static int lua_RemoveMenuItem(lua_State *L) static luaL_Reg genmenuApi[] = { + { "CreateRoot", lua_CreateRoot }, { "AddMenuItem", lua_AddMenuItem }, { "ModifyMenuItem", lua_ModifyMenuItem }, { "ShowMenuItem", lua_ShowMenuItem }, -- cgit v1.2.3