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
This commit is contained in:
parent
e512476a22
commit
7167105e22
@ -1,7 +1,7 @@
|
|||||||
|
|
||||||
-- Global variables
|
-- Global variables
|
||||||
PLUGIN = {} -- Reference to own plugin object
|
PLUGIN = {}; -- Reference to own plugin object
|
||||||
ShouldDumpFunctions = false -- If set to true, all available functions are logged upon plugin initialization
|
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:
|
-- dump all available functions to console:
|
||||||
if (ShouldDumpFunctions) then
|
if (ShouldDumpFunctions) then
|
||||||
LOG("Dumping all available functions:");
|
LOG("Dumping all available functions:");
|
||||||
function dump (prefix, a)
|
function dump (prefix, a, Output)
|
||||||
for i, v in pairs (a) do
|
for i, v in pairs (a) do
|
||||||
if (type(v) == "table") then
|
if (type(v) == "table") then
|
||||||
if (GetChar(i, 1) ~= ".") then
|
if (GetChar(i, 1) ~= ".") then
|
||||||
@ -31,15 +31,26 @@ function Initialize(Plugin)
|
|||||||
elseif (v == _G.package) then
|
elseif (v == _G.package) then
|
||||||
LOG(prefix .. i .. " == _G.package, ignoring");
|
LOG(prefix .. i .. " == _G.package, ignoring");
|
||||||
else
|
else
|
||||||
dump(prefix .. i .. ".", v)
|
dump(prefix .. i .. ".", v, Output)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
elseif (type(v) == "function") then
|
elseif (type(v) == "function") then
|
||||||
LOG(prefix .. i .. "()")
|
if (string.sub(i, 1, 2) ~= "__") then
|
||||||
|
table.insert(Output, prefix .. i .. "()");
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
dump("", _G);
|
end
|
||||||
|
|
||||||
|
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
|
end
|
||||||
|
|
||||||
return true
|
return true
|
||||||
|
Loading…
Reference in New Issue
Block a user