From 69bb6c28e2e8f98fc1aeb2ff79a7398fbf84abda Mon Sep 17 00:00:00 2001 From: Alexander Harkness Date: Tue, 30 Jul 2013 15:02:20 +0100 Subject: Moved the dumpAPI function to a new plugin. --- MCServer/Plugins/DumpAPI/main.lua | 52 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 MCServer/Plugins/DumpAPI/main.lua diff --git a/MCServer/Plugins/DumpAPI/main.lua b/MCServer/Plugins/DumpAPI/main.lua new file mode 100644 index 000000000..1a6ddda31 --- /dev/null +++ b/MCServer/Plugins/DumpAPI/main.lua @@ -0,0 +1,52 @@ + +-- Global variables +PLUGIN = {}; -- Reference to own plugin object + +function Initialize(Plugin) + PLUGIN = Plugin + + Plugin:SetName("DumpAPI") + 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 -- cgit v1.2.3 From 624c0a7554c7c6393284e7ef939414e882250675 Mon Sep 17 00:00:00 2001 From: Alexander Harkness Date: Tue, 30 Jul 2013 15:07:40 +0100 Subject: Removed old features and fix #25. --- MCServer/Plugins/Debuggers/Debuggers.lua | 55 -------------------------------- 1 file changed, 55 deletions(-) diff --git a/MCServer/Plugins/Debuggers/Debuggers.lua b/MCServer/Plugins/Debuggers/Debuggers.lua index 53b192656..b090ea55c 100644 --- a/MCServer/Plugins/Debuggers/Debuggers.lua +++ b/MCServer/Plugins/Debuggers/Debuggers.lua @@ -1,16 +1,9 @@ -- 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 +34,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(); @@ -54,48 +41,6 @@ function Initialize(Plugin) 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 - - - - - function TestBlockAreas() LOG("Testing block areas..."); -- cgit v1.2.3 From 23b9f83fac8d6556ea353e9924094b58c703a538 Mon Sep 17 00:00:00 2001 From: Alexander Harkness Date: Tue, 30 Jul 2013 16:24:13 +0100 Subject: Moved the file to a more sensible name. --- MCServer/Plugins/APIDump/main.lua | 52 +++++++++++++++++++++++++++++++++++++++ MCServer/Plugins/DumpAPI/main.lua | 52 --------------------------------------- 2 files changed, 52 insertions(+), 52 deletions(-) create mode 100644 MCServer/Plugins/APIDump/main.lua delete mode 100644 MCServer/Plugins/DumpAPI/main.lua diff --git a/MCServer/Plugins/APIDump/main.lua b/MCServer/Plugins/APIDump/main.lua new file mode 100644 index 000000000..1a6ddda31 --- /dev/null +++ b/MCServer/Plugins/APIDump/main.lua @@ -0,0 +1,52 @@ + +-- Global variables +PLUGIN = {}; -- Reference to own plugin object + +function Initialize(Plugin) + PLUGIN = Plugin + + Plugin:SetName("DumpAPI") + 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/DumpAPI/main.lua b/MCServer/Plugins/DumpAPI/main.lua deleted file mode 100644 index 1a6ddda31..000000000 --- a/MCServer/Plugins/DumpAPI/main.lua +++ /dev/null @@ -1,52 +0,0 @@ - --- Global variables -PLUGIN = {}; -- Reference to own plugin object - -function Initialize(Plugin) - PLUGIN = Plugin - - Plugin:SetName("DumpAPI") - 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 -- cgit v1.2.3 From e57b4e1e59075254f5f26545e2180cda7346146b Mon Sep 17 00:00:00 2001 From: Alexander Harkness Date: Tue, 30 Jul 2013 16:26:06 +0100 Subject: Changed name and put the whitespace back, as per xoft's suggestion. --- MCServer/Plugins/APIDump/main.lua | 13 +++++++++++-- MCServer/Plugins/Debuggers/Debuggers.lua | 12 +++++++++++- 2 files changed, 22 insertions(+), 3 deletions(-) diff --git a/MCServer/Plugins/APIDump/main.lua b/MCServer/Plugins/APIDump/main.lua index 1a6ddda31..853ff6301 100644 --- a/MCServer/Plugins/APIDump/main.lua +++ b/MCServer/Plugins/APIDump/main.lua @@ -1,11 +1,15 @@ - -- Global variables PLUGIN = {}; -- Reference to own plugin object + + + + + function Initialize(Plugin) PLUGIN = Plugin - Plugin:SetName("DumpAPI") + Plugin:SetName("APIDump") Plugin:SetVersion(1) PluginManager = cRoot:Get():GetPluginManager() @@ -17,6 +21,11 @@ function Initialize(Plugin) return true end + + + + + function DumpAPI() LOG("Dumping all available functions to API.txt..."); function dump (prefix, a, Output) diff --git a/MCServer/Plugins/Debuggers/Debuggers.lua b/MCServer/Plugins/Debuggers/Debuggers.lua index b090ea55c..ab3397f74 100644 --- a/MCServer/Plugins/Debuggers/Debuggers.lua +++ b/MCServer/Plugins/Debuggers/Debuggers.lua @@ -1,9 +1,14 @@ - -- Global variables PLUGIN = {}; -- Reference to own plugin object + 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,6 +46,11 @@ function Initialize(Plugin) return true end; + + + + + function TestBlockAreas() LOG("Testing block areas..."); -- cgit v1.2.3