Adding panel modules

Far Manager Macro System

Adding panel modules


“Panel module” is a set of Lua functions placed in a table and loaded with PanelModule function.

  • Names of those functions and their parameter sets coincide with functions from export table (see LuaFAR manual).
  • Here is the list of module-exported functions that are supported by the plugin:
    Analyse, ClosePanel, Compare, DeleteFiles, GetFiles, GetFindData, GetOpenPanelInfo, MakeDirectory, Open, ProcessHostFile, ProcessPanelEvent, ProcessPanelInput, PutFiles, SetDirectory, SetFindList.
  • Every panel module must contain a table Info with a mandatory field Guid. Other fields are optional.
-- Create a panel module
local mod  = {}
mod.Info = {
  Guid        = win.Uuid("FBBC5FBF-AE9F-46EC-999C-C744F7D898B6"); -- mandatory field
  Version     = "";
  Title       = "";
  Description = "";
  Author      = "";
}

-- Add only those "exported" functions that are needed for this panel module
mod.Analyse     = function(...) ...... end
mod.Open        = function(...) ...... end
mod.GetFindData = function(...) ...... end
......

-- Load the module
PanelModule(mod)

Notes:

  1. To create a panel from the command line or from the plugins menu, the existing function CommandLine and MenuItem should be used. Their action() should return 2 values: (1) the module table and (2) the panel object (any non-false Lua value).
  2. Function mod.Open is called by the plugin only with the following values of OpenFrom parameter:
    OPEN_ANALYSE, OPEN_FINDLIST and OPEN_SHORTCUT.

See also: Demo Example