Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Excerpt

Run a diagnostic.

 

Syntax

Code Block
themeRDark
languagejavascript
linenumberstrue
var result = Diag.run(name, params); // run a diagnostic

Parameters

ParameterTypeMandatoryNotesDiag Ver
nameString(tick)

Name of the diagnostic routine.

(warning) Must not contain any spaces! Will always be converted to lowercase.

1.0
paramsVariant(error)

Any additional parameters to pass in to the routine.

(warning) Note that if using the in-game chat interface they will all be stings.

1.0

Return values

ValueTypeNotesDiag Ver
<string>StringThe results of the diagnostic in a single string.1.0
<array>Array of StringThe results of the diagnostic in an array of strings (or values that will reliably typecast to strings).1.0
<error>String

If something goes wrong, the error message will be returned as a string.

1.0

Example

Code Block
themeRDark
languagejavascript
titleEcho parameters back to calling script
linenumberstrue
// define a diagnostic routine function
var myDiagFn = function bar(name, param1, param2, etc) {
  // name always converted to lowercase
  // return arguments object converted in to an array
  return Array.prototype.splice.call(arguments);
}
 
Diag.add("foo", myDiagFn); // register myDiagFn under the name "foo"

Diag("Foo", true, "bleh"); // ["foo", true, "bleh"]

Notes

See Diag.add() for notes about diagnostic routine functions.