summaryrefslogtreecommitdiffstats
path: root/Server/Plugins/TestLuaRocks/TestLuaRocks.lua
diff options
context:
space:
mode:
authorMattes D <github@xoft.cz>2015-08-26 10:58:51 +0200
committerMattes D <github@xoft.cz>2015-09-05 22:01:21 +0200
commitdac97826f7d0c9b9135c1a08c4d5f16b61494bd1 (patch)
treeec17a9703fe734956e4f151cb5306befc4fd7571 /Server/Plugins/TestLuaRocks/TestLuaRocks.lua
parentMerge pull request #2459 from cuberite/fixes (diff)
downloadcuberite-dac97826f7d0c9b9135c1a08c4d5f16b61494bd1.tar
cuberite-dac97826f7d0c9b9135c1a08c4d5f16b61494bd1.tar.gz
cuberite-dac97826f7d0c9b9135c1a08c4d5f16b61494bd1.tar.bz2
cuberite-dac97826f7d0c9b9135c1a08c4d5f16b61494bd1.tar.lz
cuberite-dac97826f7d0c9b9135c1a08c4d5f16b61494bd1.tar.xz
cuberite-dac97826f7d0c9b9135c1a08c4d5f16b61494bd1.tar.zst
cuberite-dac97826f7d0c9b9135c1a08c4d5f16b61494bd1.zip
Diffstat (limited to 'Server/Plugins/TestLuaRocks/TestLuaRocks.lua')
-rw-r--r--Server/Plugins/TestLuaRocks/TestLuaRocks.lua49
1 files changed, 49 insertions, 0 deletions
diff --git a/Server/Plugins/TestLuaRocks/TestLuaRocks.lua b/Server/Plugins/TestLuaRocks/TestLuaRocks.lua
new file mode 100644
index 000000000..4a7cd4e1e
--- /dev/null
+++ b/Server/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.len(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