summaryrefslogtreecommitdiffstats
path: root/MCServer/Plugins/APIDump/main_APIDump.lua
diff options
context:
space:
mode:
Diffstat (limited to 'MCServer/Plugins/APIDump/main_APIDump.lua')
-rw-r--r--MCServer/Plugins/APIDump/main_APIDump.lua14
1 files changed, 12 insertions, 2 deletions
diff --git a/MCServer/Plugins/APIDump/main_APIDump.lua b/MCServer/Plugins/APIDump/main_APIDump.lua
index 239bec69c..e841922b6 100644
--- a/MCServer/Plugins/APIDump/main_APIDump.lua
+++ b/MCServer/Plugins/APIDump/main_APIDump.lua
@@ -285,7 +285,7 @@ local function WriteHtmlHook(a_Hook, a_HookNav)
for _, param in ipairs(a_Hook.Params) do
f:write("<tr><td>", param.Name, "</td><td>", LinkifyString(param.Type, HookName), "</td><td>", LinkifyString(param.Notes, HookName), "</td></tr>\n");
end
- f:write("</table>\n<p>" .. (a_Hook.Returns or "") .. "</p>\n\n");
+ f:write("</table>\n<p>" .. LinkifyString(a_Hook.Returns or "", HookName) .. "</p>\n\n");
f:write([[<hr /><h1>Code examples</h1><h2>Registering the callback</h2>]]);
f:write("<pre class=\"prettyprint lang-lua\">\n");
f:write([[cPluginManager:AddHook(cPluginManager.]] .. a_Hook.Name .. ", My" .. a_Hook.DefaultFnName .. [[);]]);
@@ -971,7 +971,7 @@ end
--- Writes a list of undocumented objects into a file
local function ListUndocumentedObjects(API, UndocumentedHooks)
- f = io.open("API/_undocumented.lua", "w");
+ local f = io.open("API/_undocumented.lua", "w");
if (f ~= nil) then
f:write("\n-- This is the list of undocumented API objects, automatically generated by APIDump\n\n");
f:write("g_APIDesc =\n{\n\tClasses =\n\t{\n");
@@ -1643,6 +1643,15 @@ end
+local function HandleCmdApiShow(a_Split, a_EntireCmd)
+ os.execute("API" .. cFile:GetPathSeparator() .. "index.html")
+ return true, "Launching the browser to show the API docs..."
+end
+
+
+
+
+
function Initialize(Plugin)
g_Plugin = Plugin;
g_PluginFolder = Plugin:GetLocalFolder();
@@ -1651,6 +1660,7 @@ function Initialize(Plugin)
-- Bind a console command to dump the API:
cPluginManager:BindConsoleCommand("api", HandleCmdApi, "Dumps the Lua API docs into the API/ subfolder")
+ cPluginManager:BindConsoleCommand("apishow", HandleCmdApiShow, "Runs the default browser to show the API docs")
-- Add a WebAdmin tab that has a Dump button
g_Plugin:AddWebTab("APIDump", HandleWebAdminDump)