mirror of
https://github.com/mapbase-source/source-sdk-2013.git
synced 2025-02-26 13:41:11 +03:00
Add vscript documentation sorting
This commit is contained in:
parent
c25053d1d2
commit
9156ba84bd
@ -1,8 +1,8 @@
|
|||||||
static char g_Script_vscript_squirrel[] = R"vscript(
|
static char g_Script_vscript_squirrel[] = R"vscript(
|
||||||
//========= Mapbase - https://github.com/mapbase-source/source-sdk-2013 ============//
|
//========= Mapbase - https://github.com/mapbase-source/source-sdk-2013 ============//
|
||||||
//
|
//
|
||||||
// Purpose:
|
// Purpose:
|
||||||
//
|
//
|
||||||
//=============================================================================//
|
//=============================================================================//
|
||||||
|
|
||||||
Warning <- error;
|
Warning <- error;
|
||||||
@ -452,20 +452,28 @@ if (developer)
|
|||||||
printdocl(text);
|
printdocl(text);
|
||||||
}
|
}
|
||||||
|
|
||||||
local function PrintMatchesInDocList(pattern, list, printfunc)
|
local function PrintMatches( pattern, docs, printfunc )
|
||||||
{
|
{
|
||||||
local foundMatches = 0;
|
local matches = [];
|
||||||
|
local always = pattern == "*";
|
||||||
|
|
||||||
foreach(name, doc in list)
|
foreach( name, doc in docs )
|
||||||
{
|
{
|
||||||
if (pattern == "*" || name.tolower().find(pattern) != null || (doc[1].len() && doc[1].tolower().find(pattern) != null))
|
if (always || name.tolower().find(pattern) != null || (doc[1].len() && doc[1].tolower().find(pattern) != null))
|
||||||
{
|
{
|
||||||
foundMatches = 1;
|
matches.append( name );
|
||||||
printfunc(name, doc)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return foundMatches;
|
if ( !matches.len() )
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
matches.sort();
|
||||||
|
|
||||||
|
foreach( name in matches )
|
||||||
|
printfunc( name, docs[name] );
|
||||||
|
|
||||||
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
function __Documentation::PrintHelp(pattern = "*")
|
function __Documentation::PrintHelp(pattern = "*")
|
||||||
@ -474,12 +482,12 @@ if (developer)
|
|||||||
|
|
||||||
// Have a specific order
|
// Have a specific order
|
||||||
if (!(
|
if (!(
|
||||||
PrintMatchesInDocList( patternLower, DocumentedEnums, PrintEnum ) |
|
PrintMatches( patternLower, DocumentedEnums, PrintEnum ) |
|
||||||
PrintMatchesInDocList( patternLower, DocumentedConsts, PrintConst ) |
|
PrintMatches( patternLower, DocumentedConsts, PrintConst ) |
|
||||||
PrintMatchesInDocList( patternLower, DocumentedClasses, PrintClass ) |
|
PrintMatches( patternLower, DocumentedClasses, PrintClass ) |
|
||||||
PrintMatchesInDocList( patternLower, DocumentedFuncs, PrintFunc ) |
|
PrintMatches( patternLower, DocumentedFuncs, PrintFunc ) |
|
||||||
PrintMatchesInDocList( patternLower, DocumentedMembers, PrintMember ) |
|
PrintMatches( patternLower, DocumentedMembers, PrintMember ) |
|
||||||
PrintMatchesInDocList( patternLower, DocumentedHooks, PrintHook )
|
PrintMatches( patternLower, DocumentedHooks, PrintHook )
|
||||||
))
|
))
|
||||||
{
|
{
|
||||||
printdocl("Pattern " + pattern + " not found");
|
printdocl("Pattern " + pattern + " not found");
|
||||||
@ -503,7 +511,6 @@ else
|
|||||||
|
|
||||||
if (developer)
|
if (developer)
|
||||||
{
|
{
|
||||||
// Vector documentation
|
|
||||||
__Documentation.RegisterClassHelp( "Vector", "", "Basic 3-float Vector class." );
|
__Documentation.RegisterClassHelp( "Vector", "", "Basic 3-float Vector class." );
|
||||||
__Documentation.RegisterHelp( "Vector::Length", "float Vector::Length()", "Return the vector's length." );
|
__Documentation.RegisterHelp( "Vector::Length", "float Vector::Length()", "Return the vector's length." );
|
||||||
__Documentation.RegisterHelp( "Vector::LengthSqr", "float Vector::LengthSqr()", "Return the vector's squared length." );
|
__Documentation.RegisterHelp( "Vector::LengthSqr", "float Vector::LengthSqr()", "Return the vector's squared length." );
|
||||||
|
Loading…
x
Reference in New Issue
Block a user