MCServer API - Index
--
The API reference is divided into the following sections:
- --
-
- Class index -
- Hooks -
- Extra pages -
- Documentation statistics -
-
Class index
-The following classes are available in the MCServer Lua scripting language:
- --
-]]);
+
- Class index +
- Hooks +
- Extra pages +
- Documentation statistics +
- " .. cls.Name .. " \n"); + f:write("
- ", cls.Name, " \n"); WriteHtmlClass(cls, API); end - f:write([[
- Inheritance \n"); + cf:write("
- Inheritance \n"); end if (HasConstants) then - cf:write("
- Constants \n"); + cf:write("
- Constants \n"); end if (HasVariables) then - cf:write("
- Member variables \n"); + cf:write("
- Member variables \n"); end if (HasFunctions) then - cf:write("
- Functions \n"); + cf:write("
- Functions \n"); end if (a_ClassAPI.AdditionalInfo ~= nil) then for i, additional in ipairs(a_ClassAPI.AdditionalInfo) do - cf:write("
- ", (additional.Header or "(No header)"), " \n"); + cf:write("
- ", (additional.Header or "(No header)"), " \n"); end end - cf:write("
- " .. cls.Name .. " \n"); + cf:write("
- ", cls.Name, " \n"); end - cf:write("
MCServer API - Index
++
The API reference is divided into the following sections:
+-
+
+
Class index
+The following classes are available in the MCServer Lua scripting language: +
-
+ ]]);
for i, cls in ipairs(API) do
- f:write("
-
Hooks
- -A plugin can register to be called whenever an "interesting event" occurs. It does so by calling cPluginManager's AddHook() function and implementing a callback function to handle the event.
-A plugin can decide whether it will let the event pass through to the rest of the plugins, or hide it from them. This is determined by the return value from the hook callback function. If the function returns false or no value, the event is propagated further. If the function returns true, the processing is stopped, no other plugin receives the notification (and possibly MCServer disables the default behavior for the event). See each hook's details to see the exact behavior.
- -Hook name | -Called when | -
---|
Hook name | +Called when | +
---|
Name | \nParameters | \nReturn value | \nNotes | \n
---|
Name | Parameters | Return value | Notes |
---|---|---|---|
" .. func.Name .. " | \n"); - cf:write("", LinkifyString(func.Params or "", (a_InheritedName or a_ClassAPI.Name)), " | \n"); - cf:write("", LinkifyString(func.Return or "", (a_InheritedName or a_ClassAPI.Name)), " | \n"); - cf:write("", LinkifyString(func.Notes or "(undocumented)", (a_InheritedName or a_ClassAPI.Name)), " | \n
", func.Name, " | \n"); + cf:write("", LinkifyString(func.Params or "", (a_InheritedName or a_ClassAPI.Name)), " | \n"); + cf:write("", LinkifyString(func.Return or "", (a_InheritedName or a_ClassAPI.Name)), " | \n"); + cf:write("", LinkifyString(func.Notes or "(undocumented)", (a_InheritedName or a_ClassAPI.Name)), " |
Member variables inherited from ", a_InheritedName, "
\n"); + cf:write("Member variables inherited from ", a_InheritedName, "
\n"); end - cf:write("Name | \nType | \nNotes | \n
---|
Name | Type | Notes |
---|---|---|
", var.Name, " | \n"); - cf:write("", LinkifyString(var.Type or "(undocumented)", a_InheritedName or a_ClassAPI.Name), " | \n"); - cf:write("", LinkifyString(var.Notes or "", a_InheritedName or a_ClassAPI.Name), " | \n
", var.Name, " | \n"); + cf:write("", LinkifyString(var.Type or "(undocumented)", a_InheritedName or a_ClassAPI.Name), " | \n"); + cf:write("", LinkifyString(var.Notes or "", a_InheritedName or a_ClassAPI.Name), " | \n
]], a_ClassAPI.Name, [[
--
Contents
- --
-]]);
+
]], a_ClassAPI.Name, [[
++
Contents
+-
+ ]]);
local HasInheritance = ((#a_ClassAPI.Descendants > 0) or (a_ClassAPI.Inherits ~= nil));
@@ -947,52 +948,52 @@ function WriteHtmlClass(a_ClassAPI, a_AllAPI)
-- Write the table of contents:
if (HasInheritance) then
- cf:write("
" .. ClassName .. " class
\n"); + cf:write("", ClassName, " class
\n"); if (a_ClassAPI.Desc ~= nil) then - cf:write(""); + cf:write("
"); cf:write(LinkifyString(a_ClassAPI.Desc, ClassName)); - cf:write("
\n\n"); + cf:write("\n\n"); end; -- Write the inheritance, if available: if (HasInheritance) then - cf:write(" \nInheritance
\n"); + cf:write("Inheritance
\n"); if (#InheritanceChain > 0) then - cf:write("This class inherits from the following parent classes:
\n\n- \n");
+ cf:write("
This class inherits from the following parent classes:
- \n");
for i, cls in ipairs(InheritanceChain) do
- cf:write("
This class has the following descendants:\n"); + cf:write("
This class has the following descendants:\n"); WriteDescendants(a_ClassAPI.Descendants); - cf:write("
\n\n"); + cf:write("\n\n"); end end -- Write the constants: if (HasConstants) then - cf:write("Constants
\n"); + cf:write("Constants
\n"); WriteConstants(a_ClassAPI.Constants, a_ClassAPI.ConstantGroups, a_ClassAPI.NumConstantsInGroups, nil); g_Stats.NumTotalConstants = g_Stats.NumTotalConstants + #a_ClassAPI.Constants + (a_ClassAPI.NumConstantsInGroups or 0); for i, cls in ipairs(InheritanceChain) do @@ -1002,7 +1003,7 @@ function WriteHtmlClass(a_ClassAPI, a_AllAPI) -- Write the member variables: if (HasVariables) then - cf:write("Member variables
\n"); + cf:write("Member variables
\n"); WriteVariables(a_ClassAPI.Variables, nil); g_Stats.NumTotalVariables = g_Stats.NumTotalVariables + #a_ClassAPI.Variables; for i, cls in ipairs(InheritanceChain) do @@ -1012,7 +1013,7 @@ function WriteHtmlClass(a_ClassAPI, a_AllAPI) -- Write the functions, including the inherited ones: if (HasFunctions) then - cf:write("Functions
\n"); + cf:write("Functions
\n"); WriteFunctions(a_ClassAPI.Functions, nil); g_Stats.NumTotalFunctions = g_Stats.NumTotalFunctions + #a_ClassAPI.Functions; for i, cls in ipairs(InheritanceChain) do @@ -1023,19 +1024,12 @@ function WriteHtmlClass(a_ClassAPI, a_AllAPI) -- Write the additional infos: if (a_ClassAPI.AdditionalInfo ~= nil) then for i, additional in ipairs(a_ClassAPI.AdditionalInfo) do - cf:write("", additional.Header, "
\n"); + cf:write("", additional.Header, "
\n"); cf:write(LinkifyString(additional.Contents, ClassName)); end end - cf:write([[ -]] .. a_Hook.Name .. [[
--
-]]);
+ ]], a_Hook.Name, [[
+
+
+ ]]); f:write(LinkifyString(a_Hook.Desc, HookName)); - f:write("
\nCallback function
\nThe default name for the callback function is "); - f:write(a_Hook.DefaultFnName .. ". It has the following signature:\n\n"); - f:write("
function " .. HookName .. "("); + f:write("\nCallback function
\nThe default name for the callback function is "); + f:write(a_Hook.DefaultFnName, ". It has the following signature:\n"); + f:write("
function ", HookName, "("); if (a_Hook.Params == nil) then a_Hook.Params = {}; end @@ -1082,30 +1075,22 @@ function WriteHtmlHook(a_Hook) end f:write(param.Name); end - f:write(")\n\nParameters:
\n\n
Name | \nType | \nNotes | \n
---|
Name | Type | Notes |
---|---|---|
" .. param.Name .. " | \n" .. LinkifyString(param.Type, HookName) .. " | \n" .. LinkifyString(param.Notes, HookName) .. " | \n
", param.Name, " | ", LinkifyString(param.Type, HookName), " | ", LinkifyString(param.Notes, HookName), " |
" .. (a_Hook.Returns or "") .. "
\n\n"); - f:write([[Code examples
-Registering the callback
- -]]); - f:write("\n"); + f:write("
" .. (a_Hook.Returns or "") .. "
\n\n"); + f:write([[Code examples
Registering the callback
]]); + f:write("\n"); f:write([[cPluginManager.AddHook(cPluginManager.]] .. a_Hook.Name .. ", My" .. a_Hook.DefaultFnName .. [[);]]); f:write("\n\n"); local Examples = a_Hook.CodeExamples or {}; for i, example in ipairs(Examples) do - f:write("
" .. (example.Title or "missing Title") .. "
\n"); - f:write("" .. (example.Desc or "missing Desc") .. "
\n\n"); - f:write("" .. (example.Code or "missing Code") .. "\n\n\n"); + f:write("
", (example.Title or "missing Title"), "
\n"); + f:write("", (example.Desc or "missing Desc"), "
\n"); + f:write("", (example.Code or "missing Code"), "\n\n\n"); end - f:write([[