Skip to content

Commit

Permalink
С форума: Запуск lua: mf.postmacro(eval,"F1") приводит к ошибке "bad …
Browse files Browse the repository at this point in the history
…argument #1 to 'getfenv' (invalid level)".
  • Loading branch information
shmuz committed Mar 17, 2015
1 parent a9046a2 commit bc9278e
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 10 deletions.
2 changes: 1 addition & 1 deletion plugins/luamacro/_globalinfo.lua
@@ -1,6 +1,6 @@
function export.GetGlobalInfo()
return {
Version = { 1, 0, 0, 492 },
Version = { 1, 0, 0, 493 },
MinFarVersion = { 3, 0, 0, 4276 },
Guid = win.Uuid("4EBBEFC8-2084-4B7F-94C0-692CE136894D"),
Title = "LuaMacro",
Expand Down
2 changes: 1 addition & 1 deletion plugins/luamacro/api.lua
Expand Up @@ -415,7 +415,7 @@ function mf.eval (str, mode, lang)
return Eval_FixReturn(yieldcall("eval", macro, key))
end

local chunk, params = Shared.loadmacro(lang, str, getfenv(2))
local chunk, params = Shared.loadmacro(lang, str)
if chunk then
if mode==1 then return 0 end
if mode==3 then return "" end
Expand Down
7 changes: 6 additions & 1 deletion plugins/luamacro/changelog
@@ -1,4 +1,9 @@
shmuel 15.03.2015 15:48:33 +0200 - build 492
shmuel 17.03.2015 17:57:24 +0200 - build 493

1. С форума: Запуск lua: mf.postmacro(eval,"F1") приводит к ошибке "bad argument #1 to 'getfenv'
(invalid level)".

shmuel 15.03.2015 15:48:33 +0200 - build 492

1. LuaFAR (библиотека bit64): устранение зависимости результатов сдвиговых операций при величинах
сдвига >= 64 от применяемого компилятора.
Expand Down
2 changes: 1 addition & 1 deletion plugins/luamacro/luamacro.rc
@@ -1,6 +1,6 @@
#include <farversion.hpp>

#define PLUGIN_BUILD 492
#define PLUGIN_BUILD 493
#define PLUGIN_DESC "Lua Macros for Far Manager"
#define PLUGIN_NAME "LuaMacro"
#define PLUGIN_FILENAME "luamacro.dll"
Expand Down
12 changes: 6 additions & 6 deletions plugins/luamacro/macrotest.lua
Expand Up @@ -119,19 +119,13 @@ end
local function test_eval()
assert(eval==mf.eval)
temp=3
assert(eval("temp=5+7")==0)
assert(temp==12)
temp=3
assert(eval("temp=5+7",0,"moonscript")==0)
assert(eval("temp=5+7",1,"lua")==0)
assert(eval("temp=5+7",3,"lua")=="")
assert(eval("temp=5+7",1,"moonscript")==0)
assert(eval("temp=5+7",3,"moonscript")=="")
assert(temp==3)
assert(eval("getfenv(1).temp=12",0,"moonscript")==0)
assert(temp==12)
assert(eval("5",0,"moonscript")==0)
assert(eval("5+7",1,"lua")==11)
Expand Down Expand Up @@ -1559,10 +1553,16 @@ local function test_FarStandardFunctions()
assert(far.LStricmp("abc","def") < 0)
assert(far.LStricmp("def","abc") > 0)
assert(far.LStricmp("abc","abc") == 0)
assert(far.LStricmp("ABC","def") < 0)
assert(far.LStricmp("DEF","abc") > 0)
assert(far.LStricmp("ABC","abc") == 0)

assert(far.LStrnicmp("abc","def",3) < 0)
assert(far.LStrnicmp("def","abc",3) > 0)
assert(far.LStrnicmp("abc","abc",3) == 0)
assert(far.LStrnicmp("ABC","def",3) < 0)
assert(far.LStrnicmp("DEF","abc",3) > 0)
assert(far.LStrnicmp("ABC","abc",3) == 0)
assert(far.LStrnicmp("111abc","111def",3) == 0)
assert(far.LStrnicmp("111abc","111def",4) < 0)
end
Expand Down

0 comments on commit bc9278e

Please sign in to comment.