summaryrefslogtreecommitdiffstats
path: root/MCServer/Plugins
diff options
context:
space:
mode:
authormadmaxoft <github@xoft.cz>2013-12-03 21:48:40 +0100
committermadmaxoft <github@xoft.cz>2013-12-03 21:48:40 +0100
commit0a2fcf909c5affcb13ef42377c6e0c880dd887c7 (patch)
tree4f5151c0ff566c8871555af9167ca4691d398408 /MCServer/Plugins
parentAllowed Linux builds to use LuaRocks. (diff)
downloadcuberite-0a2fcf909c5affcb13ef42377c6e0c880dd887c7.tar
cuberite-0a2fcf909c5affcb13ef42377c6e0c880dd887c7.tar.gz
cuberite-0a2fcf909c5affcb13ef42377c6e0c880dd887c7.tar.bz2
cuberite-0a2fcf909c5affcb13ef42377c6e0c880dd887c7.tar.lz
cuberite-0a2fcf909c5affcb13ef42377c6e0c880dd887c7.tar.xz
cuberite-0a2fcf909c5affcb13ef42377c6e0c880dd887c7.tar.zst
cuberite-0a2fcf909c5affcb13ef42377c6e0c880dd887c7.zip
Diffstat (limited to 'MCServer/Plugins')
-rw-r--r--MCServer/Plugins/TestLuaRocks/TestLuaRocks.lua49
1 files changed, 49 insertions, 0 deletions
diff --git a/MCServer/Plugins/TestLuaRocks/TestLuaRocks.lua b/MCServer/Plugins/TestLuaRocks/TestLuaRocks.lua
new file mode 100644
index 000000000..6e90b1ae9
--- /dev/null
+++ b/MCServer/Plugins/TestLuaRocks/TestLuaRocks.lua
@@ -0,0 +1,49 @@
+
+-- TestLuaRocks.lua
+
+-- This is a mockup plugin that does a quick test of LuaRocks capability in MCServer
+
+-- "Success" is when the plugin loads, downloads the forum webpage and displays the headers and length and then displays both libs as loaded.
+-- "Failure" usually manifests as one of the "require" lines failing, although you have the luarock installed.
+-- Note that the plugin deliberately never fully loads, so that it can be reloaded fast by pressing its Enable button in the webadmin's plugin list.
+
+
+
+
+
+
+local log30 = require("30log");
+local socket = require("socket");
+local http = require("socket.http");
+
+
+
+
+
+LOGINFO("Trying to download a webpage...");
+local body, code, headers = http.request('http://forum.mc-server.org/index.php');
+LOG("code: " .. tostring(code));
+LOG("headers: ");
+for k, v in pairs(headers or {}) do
+ LOG(" " .. k .. ": " .. v);
+end
+LOG("body length: " .. string.length(body));
+
+
+
+
+
+function Initialize(a_Plugin)
+ if (socket == nil) then
+ LOG("LuaSocket not found");
+ else
+ LOG("LuaSocket loaded");
+ end
+ if (log30 == nil) then
+ LOG("30log not found");
+ else
+ LOG("30log loaded");
+ end
+ LOGINFO("Preventing plugin load so that it may be requested again from the webadmin.");
+ return false;
+end \ No newline at end of file