Skip to content

Fix для Review v1.20 #57

@VictorVG

Description

@VictorVG
--- Review-Macros.lua	original
+++ Review-Macros.lua	fixed
@@ -3,7 +3,7 @@
 -- Размещается в каталоге Macro\scripts
 --
 
-require "Review"
+Review = require "Review"
 
 Macro
 {

в противном случае модуль не подгружается и первый же макрос прерывает загрузку со стеком вида:

Review-Macros.lua:42: attempt to index global 'Review' (a nil value)
 Stack Traceback
 ===============
 (1) Lua metamethod '__index' at file '_macroinit.lua:2'
    Local variables:
     (*temporary) = C function: builtin#88
     (*temporary) = table: 0x03f25d00  {1:table: 0x03d2a300, 2:table: 0x03d2a380, 3:table: 0x03398688, 4:
 table: 0x03d1e318 (more...)}
 (2) main chunk of file 'Review-Macros.lua' at line 42
 (3) global C function 'xpcall'
 (4) Lua function 'LoadRegularFile' at file '.\Far\plugins\luamacro\utils.lua:780' (best
 guess)
    Local variables:
     FindData = table: 0x04a4d710  {FileAttributes:ac, CreationTime:13261094788076, ChangeTime:
 13262655783050 (more...)}
     FullPath = string: "Review-Macros.lua"
     macroinit = string: "_macroinit.lua"
     isMoonScript = nil
     f = Lua function '?' (defined at line 0 of chunk Review-Macros.lua)
     msg = nil
     env = table: 0x03c919c8  {NoMacro:function: 0x03cfba48, PanelModule:function: 0x04a4ddd0, CommandLine:
 function: 0x0492ea10 (more...)}
 (5) field C function 'RecursiveSearch'
 (6) Lua function 'LoadMacros' at file 'utils.lua:849' (best guess)
    Local variables:
     unload = boolean: false
     paths = string: "Far\\Profile\\Macros\\scripts"
     allAreas = boolean: true
     numerrors = number: 0
     newAreas = table: 0x03cfba00  {0:table: 0x03f69eb8, 1:table: 0x048a93c8, 2:table: 0x048dee40, 3:table:
  0x03f6fce0 (more...)}
     AreaNames = table: 0x02fc6058  {0:other, 1:shell, 2:viewer, 3:editor, 4:dialog, 5:search, 6:disks, 7:

Без подключённого StackTracePlus.lua поймать ошибку труднее, но она проста:

вызов require = "module" не загружает его т.к. имя модуля не определено, нужно явно его определить в форме local module = require "module" или module = require "module"

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions