Module irccd.plugin
Plugin modules.
This API provides function for the current plugin. Each plugin runs on its own Lua state so every of these functions knows which plugin is currently calling one of these
Functions
getName () | Get the plugin name. |
getHome () | Get the plugin home. |
addPath (path) | Add a path for searching plugins. |
info (name) | Get plugin information. |
list () | Iterate over the loaded plugins. |
load (path) | Load a plugin. |
reload (name) | Reload a plugin. |
unload (name) | Unload a plugin. |
Functions
- getName ()
-
Get the plugin name. (deprecated)
Returns:
-
the current plugin name
See also:
- getHome ()
-
Get the plugin home. (deprecated)
Returns the home configuration that lives in the user directory. Usually
~/.config/irccd/plugin where plugin is the plugin's
name.
Returns:
-
the plugin home
See also:
- addPath (path)
-
Add a path for searching plugins.
This function add paths where irccd can find plugins.
Parameters:
- path the path to add
- info (name)
-
Get plugin information.
Returns a table with the following information:
- name: the plugin name
- path: the full path
- home: the plugin home directory
- author: (optional) the author
- comment: (optional) the summary
- version: (optional) the version
- license: (optional) the license
Check the return value of nil to test if a plugin is loaded. Call this function without arguments to get the information about the current plugin.
Parameters:
- name the optional plugin to check, if nil is given returns this plugin information
Returns:
- the info table or nil if not found
- the error message
- list ()
-
Iterate over the loaded plugins.
This function returns an iterator function which returns a string
for each loaded plugin.
Returns:
-
the plugin name
Usage:
for p in plugin.list() do print(p) end
- load (path)
-
Load a plugin.
If the path is relative, the plugin is searched through the standard
directories, otherwise the absolute path is used.
Parameters:
- path the path
Returns:
- true on success or nil on failure
- the error message
- reload (name)
-
Reload a plugin.
Parameters:
- name the plugin to reload
- unload (name)
-
Unload a plugin.
Parameters:
- name the plugin