Added a function to dump all available Lua API functions into the Debuggers plugin.
git-svn-id: http://mc-server.googlecode.com/svn/trunk@1173 0a769ca7-a7f5-676a-18bf-c427514a06d6
This commit is contained in:
parent
2960f43782
commit
ab39853d93
@ -1,6 +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
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -17,6 +18,28 @@ function Initialize(Plugin)
|
|||||||
PluginManager:AddHook(Plugin, cPluginManager.HOOK_TAKE_DAMAGE)
|
PluginManager:AddHook(Plugin, cPluginManager.HOOK_TAKE_DAMAGE)
|
||||||
|
|
||||||
LOG("Initialized " .. Plugin:GetName() .. " v." .. Plugin:GetVersion())
|
LOG("Initialized " .. Plugin:GetName() .. " v." .. Plugin:GetVersion())
|
||||||
|
|
||||||
|
-- dump all available functions to console:
|
||||||
|
if (ShouldDumpFunctions) then
|
||||||
|
LOG("Dumping all available functions:");
|
||||||
|
function dump (prefix, a)
|
||||||
|
for i, v in pairs (a) do
|
||||||
|
if (type(v) == "table") then
|
||||||
|
if (v == _G) then
|
||||||
|
LOG(prefix .. i .. " == _G, CYCLE, ignoring");
|
||||||
|
elseif (v == _G.package) then
|
||||||
|
LOG(prefix .. i .. " == _G.package, ignoring");
|
||||||
|
else
|
||||||
|
dump(prefix .. i .. ".", v)
|
||||||
|
end
|
||||||
|
elseif (type(v) == "function") then
|
||||||
|
LOG(prefix .. i .. "()")
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
dump("", _G);
|
||||||
|
end
|
||||||
|
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user