From 7167105e22c16a0adf8b90c5a94257d4457e7bbc Mon Sep 17 00:00:00 2001 From: "madmaxoft@gmail.com" Date: Sat, 2 Feb 2013 13:43:55 +0000 Subject: Debuggers plugin dumps entire API into a file, API.txt. Enabled by default. git-svn-id: http://mc-server.googlecode.com/svn/trunk@1188 0a769ca7-a7f5-676a-18bf-c427514a06d6 --- MCServer/Plugins/Debuggers/Debuggers.lua | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) (limited to 'MCServer/Plugins/Debuggers') diff --git a/MCServer/Plugins/Debuggers/Debuggers.lua b/MCServer/Plugins/Debuggers/Debuggers.lua index 065237ba7..3e1a1ba5d 100644 --- a/MCServer/Plugins/Debuggers/Debuggers.lua +++ b/MCServer/Plugins/Debuggers/Debuggers.lua @@ -1,7 +1,7 @@ -- Global variables -PLUGIN = {} -- Reference to own plugin object -ShouldDumpFunctions = false -- If set to true, all available functions are logged upon plugin initialization +PLUGIN = {}; -- Reference to own plugin object +ShouldDumpFunctions = true; -- If set to true, all available functions are logged upon plugin initialization @@ -22,7 +22,7 @@ function Initialize(Plugin) -- dump all available functions to console: if (ShouldDumpFunctions) then LOG("Dumping all available functions:"); - function dump (prefix, a) + function dump (prefix, a, Output) for i, v in pairs (a) do if (type(v) == "table") then if (GetChar(i, 1) ~= ".") then @@ -31,15 +31,26 @@ function Initialize(Plugin) elseif (v == _G.package) then LOG(prefix .. i .. " == _G.package, ignoring"); else - dump(prefix .. i .. ".", v) + dump(prefix .. i .. ".", v, Output) end end elseif (type(v) == "function") then - LOG(prefix .. i .. "()") + if (string.sub(i, 1, 2) ~= "__") then + table.insert(Output, prefix .. i .. "()"); + end end end end - dump("", _G); + + local Output = {}; + dump("", _G, Output); + + table.sort(Output); + local f = io.open("API.txt", "w"); + for i, n in ipairs(Output) do + f:write(n, "\n"); + end + f:close(); end return true -- cgit v1.2.3