AddCommand

LuaFAR for Editor

AddCommand


AddCommand (command, file [, ...])

Function AddCommand is available to the _usermenu.lua script.
It establishes a correspondence between the given command and the specified utility (file). This allows to call that utility from the command line (or a macro).

Parameters

  1. command
    The first command line parameter after the plugin’s prefix.

  2. file
    A specification for a Lua script to run upon this item activation. The exact file name is determined according to the same rules as with require function, that is, package.path is used to search for the file. But contrary to require, the value returned by the script is not cached in package.loaded.

  3. Extra parameters (optional)
    Values that will be passed to user script (they are passed to the script in a table). There can be any number of values of any Lua type.

Examples

  AddCommand("calc",  "scripts.fl_scripts.common.calc")
  AddCommand("umenu", "scripts.Rh_Scripts.LuaPUM.LuaPUM")