diff options
author | Tycho <work.tycho+git@gmail.com> | 2014-01-22 18:13:12 +0100 |
---|---|---|
committer | Tycho <work.tycho+git@gmail.com> | 2014-01-22 18:13:12 +0100 |
commit | c832fbeb8e3f06849adc6bf02f2310c3f0331bc8 (patch) | |
tree | b990d233e6d63ecc398f77354975a01bf47466c5 /MCServer/Plugins/Debuggers | |
parent | Actually implemented interfaces (diff) | |
parent | Merge pull request #574 from tonibm19/patch-1 (diff) | |
download | cuberite-c832fbeb8e3f06849adc6bf02f2310c3f0331bc8.tar cuberite-c832fbeb8e3f06849adc6bf02f2310c3f0331bc8.tar.gz cuberite-c832fbeb8e3f06849adc6bf02f2310c3f0331bc8.tar.bz2 cuberite-c832fbeb8e3f06849adc6bf02f2310c3f0331bc8.tar.lz cuberite-c832fbeb8e3f06849adc6bf02f2310c3f0331bc8.tar.xz cuberite-c832fbeb8e3f06849adc6bf02f2310c3f0331bc8.tar.zst cuberite-c832fbeb8e3f06849adc6bf02f2310c3f0331bc8.zip |
Diffstat (limited to 'MCServer/Plugins/Debuggers')
-rw-r--r-- | MCServer/Plugins/Debuggers/Debuggers.lua | 35 |
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..."); |