1
1
static char g_Script_vscript_squirrel[] = R" vscript(
2
2
//========= Mapbase - https://github.com/mapbase-source/source-sdk-2013 ============//
3
3
//
4
- // Purpose:
5
- //
4
+ // Purpose:
5
+ //
6
6
//=============================================================================//
7
7
8
8
Warning <- error;
@@ -452,20 +452,28 @@ if (developer)
452
452
printdocl (text);
453
453
}
454
454
455
- local function PrintMatchesInDocList ( pattern, list , printfunc)
455
+ local function PrintMatches ( pattern, docs , printfunc )
456
456
{
457
- local foundMatches = 0 ;
457
+ local matches = [];
458
+ local always = pattern == " *" ;
458
459
459
- foreach (name, doc in list )
460
+ foreach ( name, doc in docs )
460
461
{
461
- if (pattern == " * " || name. tolower (). find (pattern) != null || (doc[1 ]. len () && doc[1 ]. tolower (). find (pattern) != null ))
462
+ if (always || name. tolower (). find (pattern) != null || (doc[1 ]. len () && doc[1 ]. tolower (). find (pattern) != null ))
462
463
{
463
- foundMatches = 1 ;
464
- printfunc (name, doc)
464
+ matches. append ( name );
465
465
}
466
466
}
467
467
468
- return foundMatches;
468
+ if ( ! matches. len () )
469
+ return 0 ;
470
+
471
+ matches. sort ();
472
+
473
+ foreach ( name in matches )
474
+ printfunc ( name, docs[name] );
475
+
476
+ return 1 ;
469
477
}
470
478
471
479
function __Documentation ::PrintHelp (pattern = " *" )
@@ -474,12 +482,12 @@ if (developer)
474
482
475
483
// Have a specific order
476
484
if (! (
477
- PrintMatchesInDocList ( patternLower, DocumentedEnums, PrintEnum ) |
478
- PrintMatchesInDocList ( patternLower, DocumentedConsts, PrintConst ) |
479
- PrintMatchesInDocList ( patternLower, DocumentedClasses, PrintClass ) |
480
- PrintMatchesInDocList ( patternLower, DocumentedFuncs, PrintFunc ) |
481
- PrintMatchesInDocList ( patternLower, DocumentedMembers, PrintMember ) |
482
- PrintMatchesInDocList ( patternLower, DocumentedHooks, PrintHook )
485
+ PrintMatches ( patternLower, DocumentedEnums, PrintEnum ) |
486
+ PrintMatches ( patternLower, DocumentedConsts, PrintConst ) |
487
+ PrintMatches ( patternLower, DocumentedClasses, PrintClass ) |
488
+ PrintMatches ( patternLower, DocumentedFuncs, PrintFunc ) |
489
+ PrintMatches ( patternLower, DocumentedMembers, PrintMember ) |
490
+ PrintMatches ( patternLower, DocumentedHooks, PrintHook )
483
491
))
484
492
{
485
493
printdocl (" Pattern " + pattern + " not found" );
503
511
504
512
if (developer)
505
513
{
506
- // Vector documentation
507
514
__Documentation. RegisterClassHelp ( " Vector" , " " , " Basic 3-float Vector class." );
508
515
__Documentation. RegisterHelp ( " Vector::Length" , " float Vector::Length()" , " Return the vector's length." );
509
516
__Documentation. RegisterHelp ( " Vector::LengthSqr" , " float Vector::LengthSqr()" , " Return the vector's squared length." );
0 commit comments