@@ -917,9 +917,11 @@ static void push_guid(lua_State *L, const void *pGuid)
917917HANDLE LF_Open (lua_State * L , const struct OpenInfo * Info )
918918{
919919 FP_PROTECT ();
920+ int entry_top = lua_gettop (L );
921+ HANDLE Result = NULL ;
920922
921923 if (!CheckReloadDefaultScript (L ) || !GetExportFunction (L , "Open" ))
922- return NULL ;
924+ return Result ;
923925
924926 if (Info -> OpenFrom == OPEN_LUAMACRO )
925927 return Open_Luamacro (L , Info );
@@ -986,36 +988,29 @@ HANDLE LF_Open(lua_State* L, const struct OpenInfo *Info)
986988 struct FarMacroCall * fmc = CreateFarMacroCall (1 );
987989 fmc -> Values [0 ].Type = FMVT_PANEL ;
988990 fmc -> Values [0 ].Value .Pointer = RegisterObject (L ); // nret
989- lua_pop (L ,nret ); // +0
990- return fmc ;
991+ Result = fmc ;
991992 }
992- lua_pop (L ,nret + 1 ); // +0
993- return NULL ;
993+ goto Exit ;
994994 }
995995 lua_pop (L ,1 ); // nret
996996 }
997- HANDLE hndl = FillFarMacroCall (L ,nret );
998- lua_pop (L ,nret );
999- return hndl ;
997+ Result = FillFarMacroCall (L ,nret );
1000998 }
1001999 }
10021000 else
10031001 {
10041002 if (pcall_msg (L , 3 , 1 ) == 0 )
10051003 {
10061004 if (lua_type (L ,-1 ) == LUA_TNUMBER && lua_tonumber (L ,-1 ) == -1 )
1007- {
1008- lua_pop (L ,1 );
1009- return PANEL_STOP ;
1010- }
1011- else if (lua_toboolean (L , -1 )) //+1: Obj
1012- return RegisterObject (L ); //+0
1013-
1014- lua_pop (L ,1 );
1005+ Result = PANEL_STOP ;
1006+ else if (lua_toboolean (L , -1 ))
1007+ Result = RegisterObject (L );
10151008 }
10161009 }
10171010
1018- return NULL ;
1011+ Exit :
1012+ lua_settop (L , entry_top );
1013+ return Result ;
10191014}
10201015
10211016void LF_ClosePanel (lua_State * L , const struct ClosePanelInfo * Info )
0 commit comments