Classes |
class | ArrayObject |
| Data structure for storing indexed sequences of key/value pairs. More...
|
class | ScriptGroup |
| Essentially a SimGroup, but with onAdd and onRemove script callbacks. More...
|
class | ScriptObject |
| A script-level OOP object which allows binding of a class, superClass and arguments along with declaration of methods. More...
|
class | SimGroup |
| A collection of SimObjects that are owned by the group. More...
|
class | SimSet |
| A collection of SimObjects. More...
|
Functions |
string | call (string functionName, string args...) |
| Apply the given arguments to the specified global function and return the result of the call.
|
bool | compile (string fileName, bool overrideNoDSO=false) |
| Compile a file to bytecode.
|
void | deleteVariables (string pattern) |
| Undefine all global variables matching the given name pattern.
|
bool | exec (string fileName, bool noCalls=false, bool journalScript=false) |
| Execute the given script file.
|
bool | execPrefs (string relativeFileName, bool noCalls=false, bool journalScript=false) |
| Manually execute a special script file that contains game or editor preferences.
|
void | export (string pattern, string filename="", bool append=false) |
| Write out the definitions of all global variables matching the given name pattern.
|
string | getDSOPath (string scriptFileName) |
| Get the absolute path to the file in which the compiled code for the given script file will be stored.
|
string | getVariable (string varName) |
| Returns the value of the named variable or an empty string if not found.
|
bool | isDefined (string varName) |
| Determines if a variable exists and contains a value.
|
bool | isFunction (string funcName) |
| Determines if a function exists or not.
|
bool | isMethod (string namespace, string method) |
| Determines if a class/namespace method exists.
|
void | setVariable (string varName, string value) |
| Sets the value of the named variable.
|
Functions for working with script code.
bool compile |
( |
string |
fileName, |
|
|
bool |
overrideNoDSO = false | |
|
) |
| | |
Compile a file to bytecode.
This function will read the TorqueScript code in the specified file, compile it to internal bytecode, and, if DSO generation is enabled or overrideNoDDSO is true, will store the compiled code in a .dso file in the current DSO path mirrorring the path of fileName.
- Parameters:
-
| fileName | Path to the file to compile to bytecode. |
| overrideNoDSO | If true, force generation of DSOs even if the engine is compiled to not generate write compiled code to DSO files. |
- Returns:
- True if the file was successfully compiled, false if not.
- Note:
- The definitions contained in the given file will not be made available and no code will actually be executed. Use exec() for that.
- See also:
- getDSOPath
-
exec
void export |
( |
string |
pattern, |
|
|
string |
filename = "" , |
|
|
bool |
append = false | |
|
) |
| | |
Write out the definitions of all global variables matching the given name pattern.
If fileName is not "", the variable definitions are written to the specified file. Otherwise the definitions will be printed to the console.
The output are valid TorqueScript statements that can be executed to restore the global variable values.
- Parameters:
-
| pattern | A global variable name pattern. Must begin with '$'. |
| filename | Path of the file to which to write the definitions or "" to write the definitions to the console. |
| append | If true and fileName is not "", then the definitions are appended to the specified file. Otherwise existing contents of the file (if any) will be overwritten. |
- Example:
export( "$prefs::*", "prefs.cs" );