summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbearbin <bearbin@gmail.com>2013-07-30 18:41:41 +0200
committerbearbin <bearbin@gmail.com>2013-07-30 18:41:41 +0200
commitd0adae85533a5ea6853ba778801b49393bc98741 (patch)
tree7b3693241635aec1d14f1a38b5214c51a04977ca
parentFixed .gitignore up. (diff)
parentChanged name and put the whitespace back, as per xoft's suggestion. (diff)
downloadcuberite-d0adae85533a5ea6853ba778801b49393bc98741.tar
cuberite-d0adae85533a5ea6853ba778801b49393bc98741.tar.gz
cuberite-d0adae85533a5ea6853ba778801b49393bc98741.tar.bz2
cuberite-d0adae85533a5ea6853ba778801b49393bc98741.tar.lz
cuberite-d0adae85533a5ea6853ba778801b49393bc98741.tar.xz
cuberite-d0adae85533a5ea6853ba778801b49393bc98741.tar.zst
cuberite-d0adae85533a5ea6853ba778801b49393bc98741.zip
-rw-r--r--MCServer/Plugins/APIDump/main.lua61
-rw-r--r--MCServer/Plugins/Debuggers/Debuggers.lua47
2 files changed, 62 insertions, 46 deletions
diff --git a/MCServer/Plugins/APIDump/main.lua b/MCServer/Plugins/APIDump/main.lua
new file mode 100644
index 000000000..853ff6301
--- /dev/null
+++ b/MCServer/Plugins/APIDump/main.lua
@@ -0,0 +1,61 @@
+-- Global variables
+PLUGIN = {}; -- Reference to own plugin object
+
+
+
+
+
+
+function Initialize(Plugin)
+ PLUGIN = Plugin
+
+ Plugin:SetName("APIDump")
+ Plugin:SetVersion(1)
+
+ PluginManager = cRoot:Get():GetPluginManager()
+ LOG("Initialized " .. Plugin:GetName() .. " v." .. Plugin:GetVersion())
+
+ -- dump all available API functions and objects:
+ DumpAPI();
+
+ return true
+end
+
+
+
+
+
+
+function DumpAPI()
+ LOG("Dumping all available functions to API.txt...");
+ function dump (prefix, a, Output)
+ for i, v in pairs (a) do
+ if (type(v) == "table") then
+ if (GetChar(i, 1) ~= ".") then
+ if (v == _G) then
+ LOG(prefix .. i .. " == _G, CYCLE, ignoring");
+ elseif (v == _G.package) then
+ LOG(prefix .. i .. " == _G.package, ignoring");
+ else
+ dump(prefix .. i .. ".", v, Output)
+ end
+ end
+ elseif (type(v) == "function") then
+ if (string.sub(i, 1, 2) ~= "__") then
+ table.insert(Output, prefix .. i .. "()");
+ end
+ end
+ end
+ end
+
+ local Output = {};
+ dump("", _G, Output);
+
+ table.sort(Output);
+ local f = io.open("API.txt", "w");
+ for i, n in ipairs(Output) do
+ f:write(n, "\n");
+ end
+ f:close();
+ LOG("API.txt written.");
+end
diff --git a/MCServer/Plugins/Debuggers/Debuggers.lua b/MCServer/Plugins/Debuggers/Debuggers.lua
index 53b192656..ab3397f74 100644
--- a/MCServer/Plugins/Debuggers/Debuggers.lua
+++ b/MCServer/Plugins/Debuggers/Debuggers.lua
@@ -1,16 +1,14 @@
-
-- Global variables
PLUGIN = {}; -- Reference to own plugin object
-ShouldDumpFunctions = true; -- If set to true, all available functions are written to the API.txt file upon plugin initialization
g_DropSpensersToActivate = {}; -- A list of dispensers and droppers (as {World, X, Y Z} quadruplets) that are to be activated every tick
-
g_HungerReportTick = 10;
+
function Initialize(Plugin)
PLUGIN = Plugin
@@ -41,12 +39,6 @@ function Initialize(Plugin)
LOG("Initialized " .. Plugin:GetName() .. " v." .. Plugin:GetVersion())
- -- dump all available API functions and objects:
- if (ShouldDumpFunctions) then
- DumpAPI();
- end
-
-
-- TestBlockAreas();
-- TestSQLiteBindings();
-- TestExpatBindings();
@@ -58,43 +50,6 @@ end;
-function DumpAPI()
- LOG("Dumping all available functions to API.txt...");
- function dump (prefix, a, Output)
- for i, v in pairs (a) do
- if (type(v) == "table") then
- if (GetChar(i, 1) ~= ".") then
- if (v == _G) then
- LOG(prefix .. i .. " == _G, CYCLE, ignoring");
- elseif (v == _G.package) then
- LOG(prefix .. i .. " == _G.package, ignoring");
- else
- dump(prefix .. i .. ".", v, Output)
- end
- end
- elseif (type(v) == "function") then
- if (string.sub(i, 1, 2) ~= "__") then
- table.insert(Output, prefix .. i .. "()");
- end
- end
- end
- end
-
- local Output = {};
- dump("", _G, Output);
-
- table.sort(Output);
- local f = io.open("API.txt", "w");
- for i, n in ipairs(Output) do
- f:write(n, "\n");
- end
- f:close();
- LOG("API.txt written.");
-end
-
-
-
-
function TestBlockAreas()
LOG("Testing block areas...");