Dump namespace information separate from global functions.
This commit is contained in:
@@ -506,12 +506,14 @@ XNode *LuaHelpers::GetLuaInformation()
|
|||||||
|
|
||||||
XNode *pGlobalsNode = pLuaNode->AppendChild( "GlobalFunctions" );
|
XNode *pGlobalsNode = pLuaNode->AppendChild( "GlobalFunctions" );
|
||||||
XNode *pClassesNode = pLuaNode->AppendChild( "Classes" );
|
XNode *pClassesNode = pLuaNode->AppendChild( "Classes" );
|
||||||
|
XNode *pNamespacesNode = pLuaNode->AppendChild( "Namespaces" );
|
||||||
XNode *pSingletonsNode = pLuaNode->AppendChild( "Singletons" );
|
XNode *pSingletonsNode = pLuaNode->AppendChild( "Singletons" );
|
||||||
XNode *pEnumsNode = pLuaNode->AppendChild( "Enums" );
|
XNode *pEnumsNode = pLuaNode->AppendChild( "Enums" );
|
||||||
XNode *pConstantsNode = pLuaNode->AppendChild( "Constants" );
|
XNode *pConstantsNode = pLuaNode->AppendChild( "Constants" );
|
||||||
|
|
||||||
vector<RString> vFunctions;
|
vector<RString> vFunctions;
|
||||||
map<RString, LClass> mClasses;
|
map<RString, LClass> mClasses;
|
||||||
|
map<RString, vector<RString> > mNamespaces;
|
||||||
map<RString, RString> mSingletons;
|
map<RString, RString> mSingletons;
|
||||||
map<RString, float> mConstants;
|
map<RString, float> mConstants;
|
||||||
map<RString, RString> mStringConstants;
|
map<RString, RString> mStringConstants;
|
||||||
@@ -579,6 +581,14 @@ XNode *LuaHelpers::GetLuaInformation()
|
|||||||
break;
|
break;
|
||||||
case LUA_TFUNCTION:
|
case LUA_TFUNCTION:
|
||||||
vFunctions.push_back( sKey );
|
vFunctions.push_back( sKey );
|
||||||
|
/*
|
||||||
|
{
|
||||||
|
lua_Debug ar;
|
||||||
|
lua_getfield( L, LUA_GLOBALSINDEX, sKey );
|
||||||
|
lua_getinfo( L, ">S", &ar ); // Pops the function
|
||||||
|
printf( "%s: %s\n", sKey.c_str(), ar.short_src );
|
||||||
|
}
|
||||||
|
*/
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -598,13 +608,14 @@ XNode *LuaHelpers::GetLuaInformation()
|
|||||||
LuaHelpers::Pop( L, sNamespace );
|
LuaHelpers::Pop( L, sNamespace );
|
||||||
if( find(BuiltInPackages, end, sNamespace) != end )
|
if( find(BuiltInPackages, end, sNamespace) != end )
|
||||||
continue;
|
continue;
|
||||||
|
vector<RString> &vNamespaceFunctions = mNamespaces[sNamespace];
|
||||||
FOREACH_LUATABLE( L, -1 )
|
FOREACH_LUATABLE( L, -1 )
|
||||||
{
|
{
|
||||||
RString sFunction;
|
RString sFunction;
|
||||||
LuaHelpers::Pop( L, sFunction );
|
LuaHelpers::Pop( L, sFunction );
|
||||||
vFunctions.push_back( ssprintf("%s.%s", sNamespace.c_str(), sFunction.c_str()) );
|
vNamespaceFunctions.push_back( sFunction );
|
||||||
}
|
}
|
||||||
|
sort( vNamespaceFunctions.begin(), vNamespaceFunctions.end() );
|
||||||
}
|
}
|
||||||
lua_pop( L, 2 );
|
lua_pop( L, 2 );
|
||||||
|
|
||||||
@@ -640,6 +651,19 @@ XNode *LuaHelpers::GetLuaInformation()
|
|||||||
pSingletonNode->AppendAttr( "class", s->second );
|
pSingletonNode->AppendAttr( "class", s->second );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for( map<RString, vector<RString> >::const_iterator iter = mNamespaces.begin(); iter != mNamespaces.end(); ++iter )
|
||||||
|
{
|
||||||
|
XNode *pNamespaceNode = pNamespacesNode->AppendChild( "Namespace" );
|
||||||
|
const vector<RString> &vNamespace = iter->second;
|
||||||
|
pNamespaceNode->AppendAttr( "name", iter->first );
|
||||||
|
|
||||||
|
FOREACH_CONST( RString, vNamespace, func )
|
||||||
|
{
|
||||||
|
XNode *pFunctionNode = pNamespaceNode->AppendChild( "Function" );
|
||||||
|
pFunctionNode->AppendAttr( "name", *func );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
for( map<RString, vector<RString> >::const_iterator iter = mEnums.begin(); iter != mEnums.end(); ++iter )
|
for( map<RString, vector<RString> >::const_iterator iter = mEnums.begin(); iter != mEnums.end(); ++iter )
|
||||||
{
|
{
|
||||||
XNode *pEnumNode = pEnumsNode->AppendChild( "Enum" );
|
XNode *pEnumNode = pEnumsNode->AppendChild( "Enum" );
|
||||||
|
|||||||
Reference in New Issue
Block a user