1
0

APIDump: Added the possibility to ignore classes. Ignoring Lua builtins.

This commit is contained in:
madmaxoft 2013-09-29 00:10:42 +02:00
parent 5e7e4b3a28
commit 1f9397302c
2 changed files with 40 additions and 1 deletions

View File

@ -710,7 +710,7 @@ World:ForEachChestInChunk(Player:GetChunkX(), Player:GetChunkZ(),
despawn / remove that entity in between the calls. If you need to refer to an entity later, use its despawn / remove that entity in between the calls. If you need to refer to an entity later, use its
UniqueID and {{cWorld|cWorld}}'s entity manipulation functions DoWithEntityByID(), ForEachEntity() UniqueID and {{cWorld|cWorld}}'s entity manipulation functions DoWithEntityByID(), ForEachEntity()
or ForEachEntityInChunk() to access the entity again.</p> or ForEachEntityInChunk() to access the entity again.</p>
]], ]],
Functions = Functions =
{ {
AddPosition = AddPosition =
@ -1906,6 +1906,18 @@ World:ForEachEntity(
}, },
}, },
IgnoreClasses =
{
"coroutine",
"debug",
"io",
"math",
"package",
"os",
"string",
"table",
},
IgnoreFunctions = IgnoreFunctions =
{ {

View File

@ -291,6 +291,19 @@ end
function ReadDescriptions(a_API) function ReadDescriptions(a_API)
-- Returns true if the class of the specified name is to be ignored
local function IsClassIgnored(a_ClsName)
if (g_APIDesc.IgnoreClasses == nil) then
return false;
end
for i, name in ipairs(g_APIDesc.IgnoreClasses) do
if (a_ClsName:match(name)) then
return true;
end
end
return false;
end
-- Returns true if the function (specified by its fully qualified name) is to be ignored -- Returns true if the function (specified by its fully qualified name) is to be ignored
local function IsFunctionIgnored(a_FnName) local function IsFunctionIgnored(a_FnName)
if (g_APIDesc.IgnoreFunctions == nil) then if (g_APIDesc.IgnoreFunctions == nil) then
@ -317,6 +330,20 @@ function ReadDescriptions(a_API)
return false; return false;
end end
-- Remove ignored classes from a_API:
local APICopy = {};
for i, cls in ipairs(a_API) do
if not(IsClassIgnored(cls.Name)) then
table.insert(APICopy, cls);
else
LOG("Ignoring class " .. cls.Name);
end
end
for i = 1, #a_API do
a_API[i] = APICopy[i];
end;
-- Process the documentation for each class:
for i, cls in ipairs(a_API) do for i, cls in ipairs(a_API) do
-- Rename special functions: -- Rename special functions:
for j, fn in ipairs(cls.Functions) do for j, fn in ipairs(cls.Functions) do