summaryrefslogtreecommitdiffstats
path: root/Server/Plugins/Debuggers/Inject.lua
diff options
context:
space:
mode:
authorMattes D <github@xoft.cz>2016-06-02 14:43:19 +0200
committerMattes D <github@xoft.cz>2016-06-02 14:43:19 +0200
commitbeb3660c42d93ef7386bb5158a65cb9b4fa62549 (patch)
tree1f93b893d035cc916fd3ee152ff531d110253816 /Server/Plugins/Debuggers/Inject.lua
parentFixed fall damage (diff)
downloadcuberite-beb3660c42d93ef7386bb5158a65cb9b4fa62549.tar
cuberite-beb3660c42d93ef7386bb5158a65cb9b4fa62549.tar.gz
cuberite-beb3660c42d93ef7386bb5158a65cb9b4fa62549.tar.bz2
cuberite-beb3660c42d93ef7386bb5158a65cb9b4fa62549.tar.lz
cuberite-beb3660c42d93ef7386bb5158a65cb9b4fa62549.tar.xz
cuberite-beb3660c42d93ef7386bb5158a65cb9b4fa62549.tar.zst
cuberite-beb3660c42d93ef7386bb5158a65cb9b4fa62549.zip
Diffstat (limited to '')
-rw-r--r--Server/Plugins/Debuggers/Inject.lua57
1 files changed, 57 insertions, 0 deletions
diff --git a/Server/Plugins/Debuggers/Inject.lua b/Server/Plugins/Debuggers/Inject.lua
new file mode 100644
index 000000000..d707f95e5
--- /dev/null
+++ b/Server/Plugins/Debuggers/Inject.lua
@@ -0,0 +1,57 @@
+-- Inject.lua
+
+-- This file gets injected into the Core plugin when testing the inter-plugin calls with the "testcall" command
+-- However, since this is a .lua file, it also gets loaded into the Debuggers plugin, so we need to distinguish the two
+
+
+
+
+
+--- Prints the specified table to the log, using the specified indent
+-- Assumes there are no cycles in the table and all keys and values can be turned to strings
+local function printTable(a_Table, a_Indent)
+ for k, v in pairs(a_Table) do
+ LOG(a_Indent .. "k = " .. tostring(k))
+ if (type(k) == "table") then
+ printTable(k, a_Indent .. " ")
+ end
+ LOG(a_Indent .. "v = " .. tostring(v))
+ if (type(v) == "table") then
+ printTable(v, a_Indent .. " ")
+ end
+ end
+end
+
+
+
+
+
+local function printParams(...)
+ LOG("printParams:")
+ for idx, param in ipairs({...}) do
+ LOG(" param" .. idx .. ": " .. tostring(param))
+ if (type(param) == "table") then
+ printTable(param, " ")
+ end
+ end
+ LOG("done")
+ return true
+end
+
+
+
+
+
+local pluginName = cPluginManager:Get():GetCurrentPlugin():GetName()
+if (pluginName ~= "Debuggers") then
+ -- We're in the destination plugin
+ LOG("Loaded Inject.lua into " .. pluginName)
+ injectedPrintParams = printParams
+ return true
+else
+ -- We're in the Debuggers plugin, do nothing
+end
+
+
+
+