Orxonox
0.0.5 Codename: Arcturus
|
Declaration of the TclBind class. More...
Go to the source code of this file.
Classes | |
class | orxonox::TclBind |
A wrapper class for a Tcl interpreter. More... | |
Namespaces | |
orxonox | |
Die Wagnis Klasse hat die folgenden Aufgaben: | |
Declaration of the TclBind class.
orxonox::TclBind is a wrapper class for a Tcl interpreter. It is implemented as singleton, so it can be accessed by everyone, but all share the same static Tcl interpreter. If you need a Tcl interpreter at your own, see orxonox::TclThreadManager for more information.
orxonox::TclBind is used by orxonox::CommandExecutor to execute Tcl commands. It can also be used to execute Tcl commands from different sources, but note that they may interfer with the ingame console if used improperly. By no means execute blocking commands such as endless loops or the tcl command vwait
. Use orxonox::TclThreadManager and execute these commands in a multithreaded Tcl interpreter instead.
TclBind also defines different callback functions to return commands from the Tcl interpreter back to Orxonox. Because of that it's possible to send a mixture of Orxonox- and Tcl-commands to TclBind::eval() and still get the desired behavior.
Example:
Note that puts
and log
behave slightly different, even though both can print text to the console. puts
needs quotation marks around multi-word output, while log
doesn't. puts
on the other hand supports the flag -nonewline
.
TclBind::eval() can also be used to obtain the return-value of a Tcl command: