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 fieldGuid
. 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:
- To create a panel from the command line or from the plugins menu, the existing function
CommandLine
andMenuItem
should be used. Theiraction()
should return 2 values: (1) the module table and (2) the panel object (any non-false Lua value). - Function
mod.Open
is called by the plugin only with the following values ofOpenFrom
parameter:
OPEN_ANALYSE
,OPEN_FINDLIST
andOPEN_SHORTCUT
.
See also: Demo Example