summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--MCServer/Plugins/Debuggers/Debuggers.lua23
1 files changed, 23 insertions, 0 deletions
diff --git a/MCServer/Plugins/Debuggers/Debuggers.lua b/MCServer/Plugins/Debuggers/Debuggers.lua
index f2f3f9570..a619e0b0a 100644
--- a/MCServer/Plugins/Debuggers/Debuggers.lua
+++ b/MCServer/Plugins/Debuggers/Debuggers.lua
@@ -1,6 +1,7 @@
-- Global variables
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)
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
end