Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changes between Version 7 and Version 8 of code/doc/CommandExecutor


Ignore:
Timestamp:
Apr 12, 2017, 10:41:41 PM (8 years ago)
Author:
landauf
Comment:

fixed links

Legend:

Unmodified
Added
Removed
Modified
  • code/doc/CommandExecutor

    v7 v8  
    11= !CommandExecutor =
    2 [[TracNav(TracNav/TOC_Development)]]
    32[[TOC]]
    43
     
    1615'''execute('''''string''''')''' parses the string and searches a [wiki:ConsoleCommand] with the given name. Given arguments (separated by spaces) are used to execute the !ConsoleCommand.
    1716
    18 ''string'' has to be a complete !ConsoleCommand (complete in the sense that the command exists and all needed arguments are given), otherwise the !CommandExecutor returns false and sends an [wiki:Debug error message] to the output.
     17''string'' has to be a complete !ConsoleCommand (complete in the sense that the command exists and all needed arguments are given), otherwise the !CommandExecutor returns false and sends an [wiki:Output error message] to the output.
    1918
    2019 * Example 1:
     
    2827CommandExecutor::execute("MyClass myfunction 0.1 0.2 0.3");
    2928}}}
    30     This is equal to ''MyClass::myfunction(0.1, 0.2, 0.3)'' provided that the function "myfunction" of the class "MyClass" was declared as a !ConsoleCommand.
     29    This is equal to ''MyClass::myfunction(0.1, 0.2, 0.3)'' provided that the function "myfunction" of the class "!MyClass" was declared as a !ConsoleCommand.
    3130
    3231The execute function optionally takes a second argument: '''execute('''''string, bUseTcl''''')'''. If ''bUseTcl'' is set to true (this is the default!) a command is first passed to Tcl (see [wiki:TclBind] for more information). Tcl parses the command, executes all Tcl-related code and if it finds a !ConsoleCommand only known to Orxonox it passes the command back to CommandExecutor::execute with ''bUseTcl = false''.
     
    3635CommandExecutor::execute("MyClass myfunction [expr 10+10]");
    3736}}}
    38     This command will be sent to Tcl. Tcl first evaluates the subcommand within brackets ''expr 10+10'' which results ''20'' and then returns "MyClass myfunction 20" back to Orxonox where it will be executed equivalent to ''MyClass::myfunction(20)''.
     37    This command will be sent to Tcl. Tcl first evaluates the subcommand within brackets ''expr 10+10'' which results ''20'' and then returns "!MyClass myfunction 20" back to Orxonox where it will be executed equivalent to ''MyClass::myfunction(20)''.
    3938
    4039=== hint() ===