Skip to content

Commit

Permalink
Рефакторинг.
Browse files Browse the repository at this point in the history
  • Loading branch information
shmuz committed Feb 21, 2015
1 parent 240bf75 commit 0b77858
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 14 deletions.
4 changes: 2 additions & 2 deletions plugins/luamacro/_globalinfo.lua
@@ -1,7 +1,7 @@
function export.GetGlobalInfo()
return {
Version = { 1, 0, 0, 485 },
MinFarVersion = { 3, 0, 0, 4274 },
Version = { 1, 0, 0, 486 },
MinFarVersion = { 3, 0, 0, 4275 },
Guid = win.Uuid("4EBBEFC8-2084-4B7F-94C0-692CE136894D"),
Title = "LuaMacro",
Description = "Far macros in Lua",
Expand Down
6 changes: 5 additions & 1 deletion plugins/luamacro/changelog
@@ -1,4 +1,8 @@
shmuel 21.02.2015 00:56:10 +0200 - build 485
shmuel 21.02.2015 19:30:30 +0200 - build 486

1. Рефакторинг.

shmuel 21.02.2015 00:56:10 +0200 - build 485

1. Рефакторинг.

Expand Down
7 changes: 6 additions & 1 deletion plugins/luamacro/luafar/luamacro.c
Expand Up @@ -68,7 +68,12 @@ HANDLE Open_Luamacro(lua_State* L, const struct OpenInfo *Info)
}
ReturnType = lua_type(L,-2)==LUA_TNUMBER ? lua_tointeger(L,-2) : 1;

if(lua_type(L,-1) != LUA_TTABLE)
if (lua_istable(L,-2))
{
lua_pop(L,1);
lua_pushvalue(L,-1);
}
if (!lua_istable(L,-1))
{
InitMPR(L, &om_info->Ret, 0, ReturnType);
lua_pop(L,2);
Expand Down
8 changes: 2 additions & 6 deletions plugins/luamacro/luamacro.lua
Expand Up @@ -29,10 +29,6 @@ local function pack (...)
return { n=select("#",...), ... }
end
local function pack3 (v1, v2, v3, ...)
return v1, v2, v3, { n=select("#",...), ... }
end
-- Override coroutine.resume for scripts, making it possible to call Keys(),
-- print(), Plugin.Call(), exit(), etc. from nested coroutines.
function coroutine.resume(co, ...)
Expand Down Expand Up @@ -384,12 +380,12 @@ function export.Open (OpenFrom, arg1, ...)
elseif calltype==F.MCT_PANELSORT then
if panelsort then
TablePanelSort = { panelsort.SortPanelItems(...) }
if TablePanelSort[1] then return F.MPRT_NORMALFINISH, TablePanelSort end
if TablePanelSort[1] then return TablePanelSort end
end
elseif calltype==F.MCT_GETCUSTOMSORTMODES then
if panelsort then
TablePanelSort = panelsort.GetSortModes()
return F.MPRT_NORMALFINISH, TablePanelSort
return TablePanelSort
end
end
Expand Down
2 changes: 1 addition & 1 deletion plugins/luamacro/luamacro.rc
@@ -1,6 +1,6 @@
#include <farversion.hpp>

#define PLUGIN_BUILD 485
#define PLUGIN_BUILD 486
#define PLUGIN_DESC "Lua Macros for Far Manager"
#define PLUGIN_NAME "LuaMacro"
#define PLUGIN_FILENAME "luamacro.dll"
Expand Down
6 changes: 3 additions & 3 deletions plugins/luamacro/utils.lua
Expand Up @@ -470,9 +470,9 @@ local function EnumMacros (strArea, resetEnum)
EnumState.index = EnumState.index + 1
local macro = LoadedMacros[EnumState.index]
if macro then
if macro.area and macro.area:lower():find(area) then
if not macro.disabled and macro.area and macro.area:lower():find(area) then
LastMessage = pack(macro.key, macro.description or "")
return F.MPRT_NORMALFINISH, LastMessage
return LastMessage
end
else
EnumState.index = 0
Expand Down Expand Up @@ -906,7 +906,7 @@ local function GetMacroWrapper (argMode, argKey, argUseCommon)
local macro,area = GetMacro(argMode, argKey, argUseCommon, true)
if macro then
LastMessage = pack(GetAreaCode(area), macro.code or "", macro.description or "", macro.flags)
return F.MPRT_NORMALFINISH, LastMessage
return LastMessage
end
end

Expand Down

0 comments on commit 0b77858

Please sign in to comment.