diff options
Diffstat (limited to 'MCServer')
-rw-r--r-- | MCServer/Plugins/APIDump/APIDesc.lua | 1 | ||||
-rw-r--r-- | MCServer/Plugins/APIDump/main.lua | 43 |
2 files changed, 30 insertions, 14 deletions
diff --git a/MCServer/Plugins/APIDump/APIDesc.lua b/MCServer/Plugins/APIDump/APIDesc.lua index d2f6f3437..c5ae0f890 100644 --- a/MCServer/Plugins/APIDump/APIDesc.lua +++ b/MCServer/Plugins/APIDump/APIDesc.lua @@ -1309,6 +1309,7 @@ A list of items regarding WebPlugins that have been documented "globals.assert", "globals.collectgarbage", "globals.xpcall", + "%a+\.__%a+", -- AnyClass.__Anything }, } ; diff --git a/MCServer/Plugins/APIDump/main.lua b/MCServer/Plugins/APIDump/main.lua index b16df3c04..5f8dc64b7 100644 --- a/MCServer/Plugins/APIDump/main.lua +++ b/MCServer/Plugins/APIDump/main.lua @@ -117,14 +117,14 @@ function CreateAPITables() local Globals = {Functions = {}, Constants = {}, Descendants = {}}; local API = {}; - local function Add(a_APIContainer, a_ClassName, a_ClassObj) - if (type(a_ClassObj) == "function") then - table.insert(a_APIContainer.Functions, {Name = a_ClassName}); + local function Add(a_APIContainer, a_ObjName, a_ObjValue) + if (type(a_ObjValue) == "function") then + table.insert(a_APIContainer.Functions, {Name = a_ObjName}); elseif ( - (type(a_ClassObj) == "number") or - (type(a_ClassObj) == "string") + (type(a_ObjValue) == "number") or + (type(a_ObjValue) == "string") ) then - table.insert(a_APIContainer.Constants, {Name = a_ClassName, Value = a_ClassObj}); + table.insert(a_APIContainer.Constants, {Name = a_ObjName, Value = a_ObjValue}); end end @@ -153,12 +153,7 @@ function CreateAPITables() for i, v in pairs(_G) do if (type(v) == "table") then - -- It is a table - probably a class - local StartLetter = GetChar(i, 0); - if (StartLetter == "c") then - -- Starts with a "c", handle it as a MCS API class - table.insert(API, ParseClass(i, v)); - end + table.insert(API, ParseClass(i, v)); else Add(Globals, i, v); end @@ -221,7 +216,18 @@ end function ReadDescriptions(a_API) + -- Returns true if the function (specified by its fully qualified name) is to be ignored + local function IsFunctionIgnored(a_FnName) + for i, name in ipairs(g_APIDesc.IgnoreFunctions) do + if (a_FnName:match(name)) then + return true; + end + end + return false; + end + local UnexportedDocumented = {}; -- List of API objects that are documented but not exported, simply a list of names + for i, cls in ipairs(a_API) do local APIDesc = g_APIDesc.Classes[cls.Name]; if (APIDesc ~= nil) then @@ -272,9 +278,18 @@ function ReadDescriptions(a_API) end end -- if (APIDesc.Constants ~= nil) - end + -- Remove ignored functions: + local NewFunctions = {}; + for j, fn in ipairs(cls.Functions) do + if (not(IsFunctionIgnored(cls.Name .. "." .. fn.Name))) then + table.insert(NewFunctions, fn); + end + end -- for j, fn + cls.Functions = NewFunctions; + + end -- if (APIDesc ~= nil) end -- for i, cls - + -- Sort the descendants lists: for i, cls in ipairs(a_API) do table.sort(cls.Descendants, |