Skip to content

Commit

Permalink
LuaFAR: refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
shmuz committed Oct 3, 2024
1 parent 5dc0127 commit ee9c3d0
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 2 deletions.
2 changes: 1 addition & 1 deletion plugins/luamacro/_globalinfo.lua
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
function export.GetGlobalInfo()
return {
Version = { 3, 0, 0, 850 },
Version = { 3, 0, 0, 851 },
MinFarVersion = { 3, 0, 0, 6327 },
Guid = win.Uuid("4EBBEFC8-2084-4B7F-94C0-692CE136894D"),
Title = "LuaMacro",
Expand Down
4 changes: 4 additions & 0 deletions plugins/luamacro/changelog
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
shmuel 2024-10-03 22:41:21+03:00 - build 851

1. LuaFAR: refactoring.

drkns 2024-09-24 16:09:16+01:00 - build 850

1. Initialize all fields in user controls.
Expand Down
14 changes: 14 additions & 0 deletions plugins/luamacro/luafar/service.c
Original file line number Diff line number Diff line change
Expand Up @@ -2700,6 +2700,16 @@ static int far_GetPluginDirList(lua_State *L)
return 1;
}

static int SavedScreen_tostring (lua_State *L)
{
void **pp = (void**)luaL_checkudata(L, 1, SavedScreenType);
if (*pp)
lua_pushfstring(L, "%s (%p)", SavedScreenType, *pp);
else
lua_pushfstring(L, "%s (freed)", SavedScreenType);
return 1;
}

// RestoreScreen (handle)
// handle: handle of saved screen.
static int far_RestoreScreen(lua_State *L)
Expand Down Expand Up @@ -2742,6 +2752,10 @@ static int far_SaveScreen(lua_State *L)

*(void**)lua_newuserdata(L, sizeof(void*)) = GetPluginData(L)->Info->SaveScreen(X1,Y1,X2,Y2);
luaL_getmetatable(L, SavedScreenType);
lua_pushcfunction(L, far_FreeScreen);
lua_setfield(L, -2, "__gc");
lua_pushcfunction(L, SavedScreen_tostring);
lua_setfield(L, -2, "__tostring");
lua_setmetatable(L, -2);
return 1;
}
Expand Down
2 changes: 1 addition & 1 deletion plugins/luamacro/luafar/version.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#include <farversion.hpp>

#define PLUGIN_BUILD 850
#define PLUGIN_BUILD 851

0 comments on commit ee9c3d0

Please sign in to comment.