api/OnePlugin-1.0
'''OnePlugin-1.0''' provides a plugin framework built ontop of Ace3's Module system
OnePlugin:EnablePlugin(plugin)
Enables a plugin
Parameters
- plugin
 
OnePlugin:GetPlugin(type, name, silent)
Returns an existing plugin
Parameters
- type
 - a valid registered plugin type
 - name
 - the name of this plugin, must be unique.
 - silent
 - whether or not to error when called.
 
OnePlugin:IteratePluginTypes()
Provides an iterator for scanning the available plugin types
Return value
a iterator over the name, prototype of the available types.
Usage
-- Print a list of all registered plugin types. for typeName, _ in MyAddon:IteratePluginTypes() do self:Print(typeName) end
OnePlugin:IteratePluginsByType(type)
Allows for iteration over a given type of plugins.
Parameters
- type
 
Return value
an iterator over name, plugin of the available plugins.
Usage
-- Print a list of all registered plugins of a given type. for pluginName, _ in MyAddon:IteratePluginByType('plugin_type') self:Print(pluginName) end
OnePlugin:NewPlugin(type, name, ...)
Creates a new plugin and returns a table to be populated with functionality.
Provides for automatic embedding of libraries if NewModule is available.
Parameters
- type
 - a valid registered plugin type
 - name
 - the name of this plugin, must be unique.
 - ...
 - optional list of libraries to embed. Has no affect if NewModule is not available.
 
Usage
local MyPlugin = MyAddon:NewPlugin('plugin_type', 'MyPlugin')
OnePlugin:NewPluginType(name)
Creates a new plugin type.
Parameters
- name
 - Name of the plugin type
 
Return value
a fresh dictionary that can be used to build a prototype for the plugin type.
Usage
local SortingPlugins = MyAddon:NewPluginType('plugin_type')
OnePlugin:SetBasePluginPrototype(prototype)
Sets a table as being a base prototype for all of your plugins.
Parameters
- prototype
 - A table to be used as the base prototype.
 
Usage
local PluginBase = {} MyAddon:SetBasePluginPrototype(PluginBase)
Comments