plugins.init(...)
Library/Application Support/CommandPost/Plugins
folder.cp.plugins.getPluginModule(id)
getPluginModule(id)
function. It will return the module returned by the plugin's init
function. This can also be done via the default function for the library. Eg:init
function.plugin
table that allows the plugin to be initialised. The table will look something like this:plugin.id
plugin.group
plugin.required
plugin.dependencies
init
function called after its dependencies have successfully had their init
functions called. Additionally, if a plugin has a postInit
, all declared postInits
for dependencies will have been called prior to the plugin's postInit
function.function plugin.init(dependencies[, environment]) -> module
dependencies
parameter is a table containing the list of dependencies that the plugin defined via the dependencies
property. The environment
provides access to resources such as images, HTML files, or other lua modules that are bundled with the plugin. See Simple vs Complex Plugins
below.init(...)
function, like so:.lua
file that matches the above format for plugin
. The Complex version is a folder containing an init.lua
file that matches the above format..lua
files - including 3rd-party libraries if desired. These can be accessed via two main mechanisms:environment
parameter in the init
function. This is a cp.plugins.env table, which provides access to files and templates inside the plugin folder. See the documentation for details.require
method will allow loading of *.lua
files inside the plugin from the init.lua
.foo.lua
in your folder, it can be required
like so:foo
folder called bar.lua
, it can be loaded via:cp.plugins.CACHE -> table
cp.plugins.SETTINGS_DISABLED -> string
cp.plugins.IDS -> table
cp.plugins.addDependent(id) -> none
dependentPlugin
as a dependent of the plugin with the specified id.id
- The plugin package ID.dependentPlugin
- The plugin which is a dependentcp.plugins.disable(...) -> boolean, string
...
- The list of plugin package IDs.true
if the plugin was disabled, or false
if any of the plugins failed.cp.plugins.enable(...) -> boolean, string
...
- The plugin package ID.true
if the plugins had been disabled and are now enabled.cp.plugins.getDependents(pluginId)
id
- The plugin ID.cp.plugins.getPlugin(id) -> plugin
cp.plugins.getPluginIds() -> table
cp.plugins.getPluginModule(id) -> value
id
.id
- The plugin package ID.init(...)
function call.cp.plugins.getPlugins() -> table
cp.plugins.init(paths) -> cp.plugins
paths
- An array of paths to search for plugins in.cp.plugins
- The module.cp.plugins.initPlugin(id) -> module
id
- The LUA package to look ininit(...)
function call.cp.plugins.initPlugins() -> none
cp.plugins.isDisabled(id) -> boolean
id
- The plugin package ID.true
if the plugin is disabled.cp.plugins.loadComplexPlugin(path) -> plugin
init.lua
file.path
- The plugin package ID.true
if the plugin is successfully post-initialised.cp.plugins.loadDependencies(plugin) -> table
plugin
- The plugin objectnil
if any could not be loaded.cp.plugins.loadSimplePlugin(id) -> plugin
path
- The plugin package ID.true
if the plugin is successfully post-initialised.cp.plugins.postInitPlugin(id) -> boolean
id
- The plugin package ID.true
if the plugin is successfully post-initialised.cp.plugins.postInitPlugins() -> none
cp.plugins.scanDirectory(directoryPath) -> cp.plugins
directoryPath
- The path to the directory to scan.true
if the path was loaded successfully, false if there were any issues.cp.plugins.watchPluginPaths() -> none