iScript Struct Reference (Crystal Space 2.0 Public API Reference)

| ## Public API Reference

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- Class List
- Class Index
- Class Hierarchy
- Class Members

Public Member Functions
iScript Struct Reference

This provides the interface to a scripting language interpreter. More...

`#include <ivaria/script.h>`

Inheritance diagram for iScript:

List of all members.

## Public Member Functions
virtual csPtr< iScriptValue > | Call (const char *name, const csRefArray< iScriptValue > &args=csRefArray< iScriptValue >())=0
| Calls a subroutine in the script.
virtual bool | LoadModule (const char *name)=0
| Loads a named module in the script interpreter.
virtual bool | LoadModule (const char *path, const char *filename)=0
| Loads a module in the script intepreter, from a file in VFS.
virtual bool | LoadModuleNative (const char *path, const char *filename)=0
| Loads a module from a file in the native filesystem.
virtual csPtr< iScriptObject > | New (const char *type, const csRefArray< iScriptValue > &args=csRefArray< iScriptValue >())=0
| Creates an object in the script.
virtual bool | Remove (const char *name)=0
| Removes a variable from the script interpreter.
virtual csPtr< iScriptValue > | Retrieve (const char *name)=0
| Gets the value of a variable in the script interpreter.
virtual bool | RunText (const char *text)=0
| Runs some script in the scripting language.
virtual csPtr< iScriptValue > | RValue (int value)=0
| Creates a new script value container object and returns it.
virtual csPtr< iScriptValue > | RValue (float value)=0
| Creates a new script value container object and returns it.
virtual csPtr< iScriptValue > | RValue (double value)=0
| Creates a new script value container object and returns it.
virtual csPtr< iScriptValue > | RValue (const char *value)=0
| Creates a new script value container object and returns it.
virtual csPtr< iScriptValue > | RValue (bool value)=0
| Creates a new script value container object and returns it.
virtual csPtr< iScriptValue > | RValue (iScriptObject *value)=0
| Creates a new script value container object and returns it.
virtual bool | Store (const char *name, iScriptValue *value)=0
| Sets a variable in the script interpreter.

## Detailed Description

This provides the interface to a scripting language interpreter.

Remarks:
  The details of any errors encountered in scripts are sent to the iReporter.

Definition at line 249 of file script.h.

## Member Function Documentation

virtual csPtr<iScriptValue> iScript::Call | ( | const char * | name,
|  | const csRefArray< iScriptValue > & | args = `csRefArray< iScriptValue >()`
| ) |  | `[pure virtual]`

Calls a subroutine in the script.

Parameters:

  name | The name of the subroutine.
  args | An optional array of arguments to pass to the subroutine.

Returns:
  The return value of the subroutine. If the subroutine does not exist or encounters a runtime error then it returns 0. If it returns no value then it returns an iScriptValue with a bitmask of 0.

Remarks:
  Scripting languages that support pass-by-reference may change the values of the arguments.

Implemented in csScriptCommon.

virtual bool iScript::LoadModule | ( | const char * | name | ) | `[pure virtual]`

Loads a named module in the script interpreter.

Parameters:

  name | Language-dependent name of the module.

Returns:
  False if there is an error in the module or it cannot be loaded.

virtual bool iScript::LoadModule | ( | const char * | path,
|  | const char * | filename
| ) |  | `[pure virtual]`

Loads a module in the script intepreter, from a file in VFS.

Parameters:

  path | Virtual filesystem path to the script or module file.
  filename | Filename of the script or module file.

Returns:
  False if there is an error in the module or it cannot be loaded.

virtual bool iScript::LoadModuleNative | ( | const char * | path,
|  | const char * | filename
| ) |  | `[pure virtual]`

Loads a module from a file in the native filesystem.

Parameters:

  path | Native filesystem path to the script or module file.
  filename | Filename of the script or module file.

Returns:
  False if there is an error in the module or it cannot be loaded.

virtual csPtr<iScriptObject> iScript::New | ( | const char * | type,
|  | const csRefArray< iScriptValue > & | args = `csRefArray< iScriptValue >()`
| ) |  | `[pure virtual]`

Creates an object in the script.

Parameters:

  type | The name of the class to instantiate.
  args | An optional array of arguments to pass to the constructor.

Returns:
  0 if the constructor fails, or if the named class does not exist.

Remarks:
  Scripting languages that support pass-by-reference may change the values of the arguments.

virtual bool iScript::Remove | ( | const char * | name | ) | `[pure virtual]`

Removes a variable from the script interpreter.

Parameters:

  name | The name of the variable to remove.

Returns:
  False if the variable does not exist or cannot be removed.

Remarks:
  The name is given without any special characters (e.g. the dollar prefix in Perl).

virtual csPtr<iScriptValue> iScript::Retrieve | ( | const char * | name | ) | `[pure virtual]`

Gets the value of a variable in the script interpreter.

Parameters:

  name | The name of the variable to retrieve.

Returns:
  The value of the variable, or 0 if it does not exist.

Remarks:
  The name is given without any special characters (e.g. the dollar prefix in Perl).

Implemented in csScriptCommon.

virtual bool iScript::RunText | ( | const char * | text | ) | `[pure virtual]`

Runs some script in the scripting language.

Parameters:

  text | The text of the script to execute.

Returns:
  False if there was an error in the script.

virtual csPtr<iScriptValue> iScript::RValue | ( | int | value | ) | `[pure virtual]`

Creates a new script value container object and returns it.

virtual csPtr<iScriptValue> iScript::RValue | ( | float | value | ) | `[pure virtual]`

Creates a new script value container object and returns it.

virtual csPtr<iScriptValue> iScript::RValue | ( | double | value | ) | `[pure virtual]`

Creates a new script value container object and returns it.

virtual csPtr<iScriptValue> iScript::RValue | ( | const char * | value | ) | `[pure virtual]`

Creates a new script value container object and returns it.

virtual csPtr<iScriptValue> iScript::RValue | ( | bool | value | ) | `[pure virtual]`

Creates a new script value container object and returns it.

virtual csPtr<iScriptValue> iScript::RValue | ( | iScriptObject * | value | ) | `[pure virtual]`

Creates a new script value container object and returns it.

virtual bool iScript::Store | ( | const char * | name,
|  | iScriptValue * | value
| ) |  | `[pure virtual]`

Sets a variable in the script interpreter.

Parameters:

  name | The name of the variable to set.
  value | The value to set the variable to.

Returns:
  False if the variable could not be stored (e.g. illegal name, or variable already exists and is immutable).

Remarks:
  The name is given without any special characters (e.g. the dollar prefix in Perl).

Implemented in csScriptCommon.

The documentation for this struct was generated from the following file:

- ivaria/script.h