From a5e4d2be50ad50f639b7aabc6de7c115c435830e Mon Sep 17 00:00:00 2001 From: Alexander Lantsev Date: Sat, 2 Jan 2016 23:03:00 +0000 Subject: MirLua: - fixed m_schedule - massive function replace git-svn-id: http://svn.miranda-ng.org/main/trunk@16004 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/MirLua/src/m_popup.cpp | 45 ++++++++++++++---------------------------- 1 file changed, 15 insertions(+), 30 deletions(-) (limited to 'plugins/MirLua/src/m_popup.cpp') diff --git a/plugins/MirLua/src/m_popup.cpp b/plugins/MirLua/src/m_popup.cpp index 2127f70f5f..c99ea7c146 100644 --- a/plugins/MirLua/src/m_popup.cpp +++ b/plugins/MirLua/src/m_popup.cpp @@ -4,33 +4,27 @@ static POPUPDATAT* MakePopupData(lua_State *L) { POPUPDATAT *ppd = (POPUPDATAT*)mir_calloc(sizeof(POPUPDATAT)); - lua_pushliteral(L, "ContactName"); - lua_gettable(L, -2); + lua_getfield(L, -1, "ContactName"); mir_tstrcpy(ppd->lptzContactName, ptrT(mir_utf8decodeT(lua_tostring(L, -1)))); lua_pop(L, 1); - lua_pushliteral(L, "Text"); - lua_gettable(L, -2); + lua_getfield(L, -1, "Text"); mir_tstrcpy(ppd->lptzText, ptrT(mir_utf8decodeT(luaL_checkstring(L, -1)))); lua_pop(L, 1); - lua_pushliteral(L, "hContact"); - lua_gettable(L, -2); + lua_getfield(L, -1, "hContact"); ppd->lchContact = lua_tointeger(L, -1); lua_pop(L, 1); - lua_pushliteral(L, "ColorBack"); - lua_gettable(L, -2); + lua_getfield(L, -1, "ColorBack"); ppd->colorBack = lua_tonumber(L, -1); lua_pop(L, 1); - lua_pushliteral(L, "ColorText"); - lua_gettable(L, -2); + lua_getfield(L, -1, "ColorText"); ppd->colorText = lua_tonumber(L, -1); lua_pop(L, 1); - lua_pushliteral(L, "Seconds"); - lua_gettable(L, -2); + lua_getfield(L, -1, "Seconds"); ppd->iSeconds = lua_tointeger(L, -1); lua_pop(L, 1); @@ -58,51 +52,42 @@ static POPUPDATA2* MakePopupData2(lua_State *L) POPUPDATA2 *ppd = (POPUPDATA2*)mir_calloc(sizeof(POPUPDATA2)); ppd->cbSize = sizeof(POPUPDATA2); - lua_pushliteral(L, "Flags"); - lua_gettable(L, -2); + lua_getfield(L, -1, "Flags"); ppd->flags = lua_tointeger(L, -1); lua_pop(L, 1); if (!(ppd->flags & PU2_TCHAR)) ppd->flags |= PU2_TCHAR; - lua_pushliteral(L, "Title"); - lua_gettable(L, -2); + lua_getfield(L, -1, "Title"); ppd->lptzTitle = mir_utf8decodeT(lua_tostring(L, -1)); lua_pop(L, 1); - lua_pushliteral(L, "Text"); - lua_gettable(L, -2); + lua_getfield(L, -1, "Text"); ppd->lptzText = mir_utf8decodeT(luaL_checkstring(L, -1)); lua_pop(L, 1); - lua_pushliteral(L, "hContact"); - lua_gettable(L, -2); + lua_getfield(L, -1, "hContact"); ppd->lchContact = lua_tointeger(L, -1); lua_pop(L, 1); - lua_pushliteral(L, "ColorBack"); - lua_gettable(L, -2); + lua_getfield(L, -1, "ColorBack"); ppd->colorBack = lua_tonumber(L, -1); lua_pop(L, 1); - lua_pushliteral(L, "ColorText"); - lua_gettable(L, -2); + lua_getfield(L, -1, "ColorText"); ppd->colorText = lua_tonumber(L, -1); lua_pop(L, 1); - lua_pushliteral(L, "hEvent"); - lua_gettable(L, -2); + lua_getfield(L, -1, "hEvent"); ppd->lchEvent = lua_touserdata(L, -1); lua_pop(L, 1); - lua_pushliteral(L, "Timestamp"); - lua_gettable(L, -2); + lua_getfield(L, -1, "Timestamp"); ppd->dwTimestamp = lua_tonumber(L, -1); lua_pop(L, 1); - lua_pushliteral(L, "Timeout"); - lua_gettable(L, -2); + lua_getfield(L, -1, "Timeout"); ppd->iSeconds = lua_tointeger(L, -1); lua_pop(L, 1); -- cgit v1.2.3