Skip to content

Commit 81fc615

Browse files
committed
LuaFAR: refactoring
1 parent 8a387ed commit 81fc615

4 files changed

Lines changed: 18 additions & 19 deletions

File tree

plugins/luamacro/_globalinfo.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
function export.GetGlobalInfo()
22
return {
3-
Version = { 3, 0, 0, 925 },
3+
Version = { 3, 0, 0, 926 },
44
MinFarVersion = { 3, 0, 0, 6678 },
55
Guid = win.Uuid("4EBBEFC8-2084-4B7F-94C0-692CE136894D"),
66
Title = "LuaMacro",

plugins/luamacro/changelog

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
shmuel 2026-05-08 15:23:15+03:00 - build 926
2+
3+
1. LuaFAR: refactoring.
4+
15
shmuel 2026-05-07 14:49:36+03:00 - build 925
26

37
1. LuaFAR: refactoring.

plugins/luamacro/luafar/lf_exported.c

Lines changed: 12 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -917,9 +917,11 @@ static void push_guid(lua_State *L, const void *pGuid)
917917
HANDLE 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

10211016
void LF_ClosePanel(lua_State* L, const struct ClosePanelInfo *Info)
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
#include <farversion.hpp>
22

3-
#define PLUGIN_BUILD 925
3+
#define PLUGIN_BUILD 926

0 commit comments

Comments
 (0)