Functions that let you manipulate the scripting engine programmatically.
| string call |
( |
funcName |
[, args...] | ) |
|
Use the call function to dynamically build and call a function.
- Parameters
-
| funcName | A string containing the unadorned name of a function to be executed. |
| args | .. - Any arguments that should be passed to the function. |
- Returns
- Returns a string containing the results from the function that is built and called.
- See Also
- eval
Use the compile function to pre-compile a script file without executing the contents.
- Parameters
-
| fileName | A path to the script to compile. |
- Returns
- Returns 1 if the script compiled without errors and 0 if the file did not compile correctly or if the path is wrong. Also, ff the path is invalid, an error will print to the console.
- See Also
- exec
| string compilePath |
( |
path |
| ) |
|
Use the debug function to cause the engine to issue a debug break and to break into an active debugger. For this to work, the engine must have been compiled with either TORQUE_DEBUG, or INTERNAL_RELEASE defined
- Returns
- No return value.
| void deleteVariables |
( |
wildCard |
| ) |
|
Use the deleteVariables function to delete any global variable matching the wildCard statement.
- Parameters
-
| wildCard | A string identifying what variable(s) to delete. All characters used to create a global are allowed and the special symbol "*", meaning 0 or more instances of any character. |
- Returns
- No return value
Use the eval function to execute any valid script statement. If you choose to eval a multi-line statement, be sure that there are no comments or comment blocks embedded in the script string.
- Parameters
-
| script | A string containing a valid script statement. This may be a single line statement or multiple lines concatenated together with new-line characters. |
- Returns
- Returns the result of executing the script statement.
- See Also
- call
| bool exec |
( |
fileName] |
[, nocalls[, journalScript] | ) |
|
Use the exec function to compile and execute a normal script, or a special journal script. If $Pref::ignoreDSOs is set to true, the system will use .cs before a .dso file if both are found.
- Parameters
-
| fileName | A string containing a path to the script to be compiled and executed. |
| nocalls | A boolean value. If this value is set to true, then all function calls encountered while executing the script file will be skipped and not called. This allows us to re-define function definitions found in a script file, without re-executing other worker scripts in the same file. |
| journalScript | A boolean value. If this value is set tot true, and if a journal is being played, the engine will attempt to read this script from the journal stream. If no journal is playing, this field is ignored. |
- Returns
- Returns true if the file compiled and executed w/o errors, false otherwise.
- See Also
- compile
| bool execPrefs |
( |
fileName] |
[, nocalls[, journalScript] | ) |
|
| void export |
( |
wildCard] |
[,fileName[, append] | ) |
|
Use the export function to save all global variables matching the specified name pattern in wildCard to a file, either appending to that file or over-writing it.
- Parameters
-
| wildCard | A string identifying what variable(s) to export. All characters used to create a global are allowed and the special symbol "*", meaning 0 or more instances of any character. |
| fileName | A string containing a path to a file in which to save the globals and their definitions. |
| append | A boolean value. If this value is true, the file will be appended to if it exists, otherwise it will be created/over-written. |
- Returns
- No return value
| string getDSOPath |
( |
scriptFileName |
| ) |
|
Returns the DSO path of the given filename
- Parameters
-
| scriptFileName | A string contains the file to search for |
- Returns
- Returns either the requested pathname as a string, or an empty string if not found.
| string getModNameFromPath |
( |
string |
path | ) |
|
Attempts to extract a mod directory from path. Returns empty string on failure.
| string getVariable |
( |
string |
varName | ) |
|
Grabs the relevant data for the variable represented by the given string
- Parameters
-
| varName | A String representing the variable to check |
- Returns
- Returns a string containing component data for the requested variable or an empty string if not found.
| bool isFunction |
( |
string |
funcName | ) |
|
Checks whether given name represents a current valid function.
- Parameters
-
| funcName | The name of the function to check. |
- Returns
- Returns either true if the string represents a valid function or false if not.
| bool isMethod |
( |
string |
namespace, |
|
|
string |
method |
|
) |
| |
Checks whether the given method name represents a valid method within the given namespace.
- Parameters
-
| namespace | A string representing the namespace in which the method should reside. |
| method | The name of the method in question. |
- Returns
- Returns a boolean value which is true if the given mathod name represents a valid method in the namespace and false otherwise.
| void setScriptExecEcho |
( |
echo? |
| ) |
|
- Whether to echo script file execution or not.
Use the trace function to enable (or disable) function call tracing. If enabled, tracing will print a message every time a function is entered, showing what arguments it received, and it will print a message every time a function is exited, showing the return value (or last value of last statement) for that function.
- Parameters
-
| enable | A boolean value. If set to true, tracing is enabled, otherwise it is disabled. |
- Returns
- No return value