From dff343b792d2b6a65aab96ee324c0ac6b9013123 Mon Sep 17 00:00:00 2001 From: madmaxoft Date: Sat, 12 Oct 2013 18:11:14 +0200 Subject: APIDump: Added the possibility of extra code examples for hooks. --- MCServer/Plugins/APIDump/main.lua | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'MCServer') diff --git a/MCServer/Plugins/APIDump/main.lua b/MCServer/Plugins/APIDump/main.lua index 9865f4cf1..1ba9397f5 100644 --- a/MCServer/Plugins/APIDump/main.lua +++ b/MCServer/Plugins/APIDump/main.lua @@ -753,7 +753,8 @@ function WriteHtmlHook(a_Hook)

]]); f:write(LinkifyString(a_Hook.Desc)); - f:write("

Callback function

function " .. a_Hook.DefaultFnName .. "(");
+	f:write("

Callback function

The default name for the callback function is "); + f:write(a_Hook.DefaultFnName .. ". It has the following signature:

function " .. a_Hook.DefaultFnName .. "(");
 	if (a_Hook.Params == nil) then
 		a_Hook.Params = {};
 	end
@@ -774,7 +775,12 @@ function WriteHtmlHook(a_Hook)
 cPluginManager.AddHook(cPluginManager.]] .. a_Hook.Name .. ", My" .. a_Hook.DefaultFnName .. [[);
 
]]); - -- TODO: Other code examples + local Examples = a_Hook.CodeExamples or {}; + for i, example in ipairs(Examples) do + f:write("

" .. example.Title .. "

\n"); + f:write("

" .. example.Desc .. "

\n"); + f:write("
" .. example.Code .. "
\n"); + end f:close(); end -- cgit v1.2.3