Plugins

Summary
Plugins
otlib
GetPluginsA table of the plugins, indexed by plugin name.
InitPluginsIntended to be called only once by the application-specific implementation after running all plugin files.
CreatePluginCreates a plugin by name.
otlib.Plugin
SetVersionSet the version and version suffix of the plugin.
InitOverride this function if you want to run some functionality when the plugin initializes.
StartStart the plugin.
StopStop the plugin.
AddCommandAdds a command on behalf of this plugin.
AddHookAdds a hook on behalf of this plugin.

otlib

Summary
GetPluginsA table of the plugins, indexed by plugin name.
InitPluginsIntended to be called only once by the application-specific implementation after running all plugin files.
CreatePluginCreates a plugin by name.

GetPlugins

function GetPlugins()

Returns

A table of the plugins, indexed by plugin name.

Revisions

v1.00Initial.

InitPlugins

function InitPlugins()

Intended to be called only once by the application-specific implementation after running all plugin files.  Initializes the plugins.

Revisions

v1.00Initial.

CreatePlugin

function CreatePlugin(name,
description,
author)

Creates a plugin by name.  It’s safe to call this function multiple times, it will return the ‘old’ plugin table on successive calls.

Parameters

nameThe string name of the plugin.  Try to keep it short.
descriptionThe string description of the plugin.  What does it do?
authorThe string author of the plugin.

Returns

The plugin table.  You should stick any information you want to persist across plugin reloads in this table since the same table will be kept across reloads.  Any functions being called by commands also need to be put in this table.

Revisions

v1.00Initial.

otlib.Plugin

Summary
SetVersionSet the version and version suffix of the plugin.
InitOverride this function if you want to run some functionality when the plugin initializes.
StartStart the plugin.
StopStop the plugin.
AddCommandAdds a command on behalf of this plugin.
AddHookAdds a hook on behalf of this plugin.

SetVersion

function Plugin:SetVersion(version,
version_suffix)

Set the version and version suffix of the plugin.

Parameters

versionThe number that represents the version of the plugin.
version_suffixThe optional string that represents the version suffix of the plugin.  IE, “Alpha”.

Returns

Self.

Revisions

v1.00Initial.

Init

function Plugin:Init()

Override this function if you want to run some functionality when the plugin initializes.  This function is called only once.  There’s no need to call the base implementation if overridden.

Revisions

v1.00Initial.

Start

function Plugin:Start()

Start the plugin.  This makes sure we’re all hooked up to whatever we need to be.

Revisions

v1.00Initial.

Stop

function Plugin:Stop()

Stop the plugin.

Revisions

v1.00Initial.

AddCommand

function Plugin:AddCommand(console_command,
say_command,
callback,
access)

Adds a command on behalf of this plugin.

Parameters

console_commandAn optional string of the console command to add.
say_commandAn optional string of the say command to add.
callbackThe function to call if this command is called and passes access tests.  The callback receives the player calling the command followed by the arguments specified in the access object.
accessThe otlib.access object associated with this command.

Returns

Self.

Revisions

v1.00Initial.

AddHook

function Plugin:AddHook(hook,
callback,
priority)

Adds a hook on behalf of this plugin.

Parameters

hookThe application-specific hook id.
callbackThe function to call for this hook.
priorityThe priority of the hook.  TODO more descriptive.

Returns

Self.

Revisions

v1.00Initial.
function GetPlugins()
A table of the plugins, indexed by plugin name.
function InitPlugins()
Intended to be called only once by the application-specific implementation after running all plugin files.
function CreatePlugin(name,
description,
author)
Creates a plugin by name.
function Plugin:SetVersion(version,
version_suffix)
Set the version and version suffix of the plugin.
function Plugin:Init()
Override this function if you want to run some functionality when the plugin initializes.
function Plugin:Start()
Start the plugin.
function Plugin:Stop()
Stop the plugin.
function Plugin:AddCommand(console_command,
say_command,
callback,
access)
Adds a command on behalf of this plugin.
function Plugin:AddHook(hook,
callback,
priority)
Adds a hook on behalf of this plugin.
Each registered access represents a single permission.
Close