GetAvailablePlugins
From LoTROInterface Wiki
API Reference > Turbine.PluginManager.GetAvailablePlugins()
Gets the plugins that are currently available.
Syntax
Lua | |
---|---|
function PluginManager.GetAvailablePlugins(); |
Returns
Type: Object
Returns a table containing the plugins that are currently available.
Remarks
The table returned by the function is a Lua dictionary with paired keys and values. The seven dictionary entries are read from each plugin's definition file.
Key name | Value description |
---|---|
Image | Path to the image used for this plugin. The path must use forward slashes (/). Example: <Image>MyPlugins/PluginName/Resources/icon.tga</Image> |
Description | Description of the plugin created by the author. This value can be used to display multiple lines. |
Version | Version displayed in the Plugin Manager. |
Package | The name of the lua file that the plugin manager loads to "activate" the plugin. |
Author | The authors name provided in the plugin definition file. |
Name | The name displayed for the plugin when loaded into the plugin manager or when using the "/plugins list" command. Note that the name of the plugin can differ from the folder name where the plugin resides. |
ScriptState | The lua apartment name where the plugin is loaded. Plugins that share the same ScriptState (ie. same apartment name) will be unloaded when that apartment is unloaded. If the ScriptState value is left empty then the plugin is loaded as a "global" plugin. Global plugins are unloaded when the Lotro client is closed or when the "Unload All" button is pressed in the plugin manager. Additional information about the ScriptState can be found in the lotro forum post Writing LoTRO Lua Plugins for Noobs. |
Additional information about the plugin description file can be found in the lotro forum thread Writing LotRO Lua Plugins for Noobs
Example usage #1 - List all plugins and their definition information
aTableResult = Turbine.PluginManager:GetAvailablePlugins(); for aKey,aValue in ipairs(aTableResult) do if (type(aValue)=="table") then Turbine.Shell.WriteLine( aKey .. ")" ); for k, bStr in pairs(aValue) do if (type(bStr)=="string") then Turbine.Shell.WriteLine( " " .. k .. ": " .. bStr ); else Turbine.Shell.WriteLine( " " .. k .. ": Type=" .. type(bStr) ); end end -- for else if (type(aValue)=="string") then Turbine.Shell.WriteLine( aKey .. ") " .. aValue .. " " ); else Turbine.Shell.WriteLine( aKey .. ") Type=" .. type(aValue) .. " " ); end end end
The above code outputs all plugins and their definition values in the lotro client chat window. Example output is below:
1) Image: Cryoflame/MyPlugin/Resources/MyIcon.tga Description: Cryoflame Sample Plugin Version: 1.0a Package: Cryoflame.Sample.Main Author: Mr. Cryoflame Name: Cryoflame Sample plugin ScriptState: Default
Example usage #2 - Get value for a named key
aTableResult = Turbine.PluginManager:GetAvailablePlugins(); Turbine.Shell.WriteLine( aTableResult[1]["Name"] );
The code above outputs to the console the "Name" value for the first plugin in the table.