summaryrefslogtreecommitdiffstats
path: root/MCServer/Plugins/Debuggers/Debuggers.lua
diff options
context:
space:
mode:
authormadmaxoft <github@xoft.cz>2014-01-21 22:59:08 +0100
committermadmaxoft <github@xoft.cz>2014-01-21 23:00:35 +0100
commit2a018cfa49e0a85d2984f6daf6ee3c3372bdafda (patch)
treead5fd7e212a7256d3de42f101f3d74296f5b2425 /MCServer/Plugins/Debuggers/Debuggers.lua
parentFix a crash but somewhere... (diff)
downloadcuberite-2a018cfa49e0a85d2984f6daf6ee3c3372bdafda.tar
cuberite-2a018cfa49e0a85d2984f6daf6ee3c3372bdafda.tar.gz
cuberite-2a018cfa49e0a85d2984f6daf6ee3c3372bdafda.tar.bz2
cuberite-2a018cfa49e0a85d2984f6daf6ee3c3372bdafda.tar.lz
cuberite-2a018cfa49e0a85d2984f6daf6ee3c3372bdafda.tar.xz
cuberite-2a018cfa49e0a85d2984f6daf6ee3c3372bdafda.tar.zst
cuberite-2a018cfa49e0a85d2984f6daf6ee3c3372bdafda.zip
Diffstat (limited to 'MCServer/Plugins/Debuggers/Debuggers.lua')
-rw-r--r--MCServer/Plugins/Debuggers/Debuggers.lua35
1 files changed, 34 insertions, 1 deletions
diff --git a/MCServer/Plugins/Debuggers/Debuggers.lua b/MCServer/Plugins/Debuggers/Debuggers.lua
index 2d2d2736d..624261cbf 100644
--- a/MCServer/Plugins/Debuggers/Debuggers.lua
+++ b/MCServer/Plugins/Debuggers/Debuggers.lua
@@ -64,7 +64,8 @@ function Initialize(Plugin)
-- TestBlockAreas();
-- TestSQLiteBindings();
-- TestExpatBindings();
-
+ TestPluginCalls();
+
return true
end;
@@ -72,6 +73,38 @@ end;
+function TestPluginCalls()
+ -- In order to test the inter-plugin communication, we're going to call Core's ReturnColorFromChar() function
+ -- It is a rather simple function that doesn't need any tables as its params and returns a value, too
+ -- Note the signature: function ReturnColorFromChar( Split, char ) ... return cChatColog.Gray ... end
+ -- The Split parameter should be a table, but it is not used in that function anyway,
+ -- so we can get away with passing nil to it.
+
+ -- Use the old, deprecated and unsafe method:
+ local Core = cPluginManager:Get():GetPlugin("Core")
+ if (Core ~= nil) then
+ LOGINFO("Calling Core::ReturnColorFromChar() the old-fashioned way...")
+ local Gray = Core:Call("ReturnColorFromChar", nil, "8")
+ if (Gray ~= cChatColor.Gray) then
+ LOGWARNING("Call failed, exp " .. cChatColor.Gray .. ", got " .. (Gray or "<nil>"))
+ else
+ LOGINFO("Call succeeded")
+ end
+ end
+
+ -- Use the new method:
+ LOGINFO("Calling Core::ReturnColorFromChar() the recommended way...")
+ local Gray = cPluginManager:CallPlugin("Core", "ReturnColorFromChar", nil, "8")
+ if (Gray ~= cChatColor.Gray) then
+ LOGWARNING("Call failed, exp " .. cChatColor.Gray .. ", got " .. (Gray or "<nil>"))
+ else
+ LOGINFO("Call succeeded")
+ end
+end
+
+
+
+
function TestBlockAreas()
LOG("Testing block areas...");