iScriptObject 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
iScriptObject Struct Reference

This provides the interface to an object in an object-oriented scripting language. More...

`#include <ivaria/script.h>`

Inheritance diagram for iScriptObject:

List of all members.

## Public Member Functions
virtual csPtr< iScriptValue > | Call (const char *name, const csRefArray< iScriptValue > &args=csRefArray< iScriptValue >())=0
| Calls a method in the object.
virtual csPtr< iScriptValue > | Get (const char *name)=0
| Gets the value of a property in the script object.
virtual const csRef< iString > | GetClass () const =0
| Returns the name of this object's class.
virtual void * | GetPointer ()=0
| If the object is from the cspace module, this will return its pointer.
virtual iScript * | GetScript ()=0
| Returns a reference to the iScript to which this object belongs.
virtual bool | IsA (const char *) const =0
| Returns a boolean specifying whether or not the object "is a" or is derived from the named class.
virtual bool | IsType (const char *) const =0
| Deprecated version of IsA().
virtual bool | Set (const char *name, iScriptValue *value)=0
| Sets the value of a property in the script object.
virtual bool | SetPointer (void *)=0
| If the object is from the cspace module, this will allow you to change the reference to point to another object of the same class.

## Detailed Description

This provides the interface to an object in an object-oriented scripting language.

Main ways to get pointers to this interface:

- iScript::New()
- iScriptValue::GetObject()

Definition at line 102 of file script.h.

## Member Function Documentation

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

Calls a method in the object.

Parameters:

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

Returns:
  The return value of the method. If the named method does not exist or encounters a runtime error then it returns 0. If the method 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 csScriptObjectCommon.

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

Gets the value of a property in the script object.

Parameters:

  name | The name of the property.

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

Remarks:
  The minimum requirement for implementors of this method is that it work with objects from the cspace module. An implementation may support other classes, but if not then behaviour may be undefined when attempting to use such classes.

Implemented in csScriptObjectCommon.

virtual const csRef<iString> iScriptObject::GetClass | ( |  | ) | const`[pure virtual]`

Returns the name of this object's class.

If the object is from the cspace module, the name will be returned without the cspace namespace qualifier.

virtual void* iScriptObject::GetPointer | ( |  | ) | `[pure virtual]`

If the object is from the cspace module, this will return its pointer.

If it is not from the cspace module, the behaviour will be undefined.

Some implementations may wish to extend the behaviour of this method to return pointers to other types of object, but that would be specific to the implementation.

virtual iScript* iScriptObject::GetScript | ( |  | ) | `[pure virtual]`

Returns a reference to the iScript to which this object belongs.

virtual bool iScriptObject::IsA | ( | const char * |  | ) | const`[pure virtual]`

Returns a boolean specifying whether or not the object "is a" or is derived from the named class.

This may or may not be a class from the cspace module. Also, such classes may be specified with or without the cspace namespace qualifier.

virtual bool iScriptObject::IsType | ( | const char * |  | ) | const`[pure virtual]`

Deprecated version of IsA().

Implemented in csScriptObjectCommon.

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

Sets the value of a property in the script object.

Parameters:

  name | The name of the property.
  value | The value that the property will be set to.

Returns:
  False if the named property does not exist or cannot be set.

Remarks:
  The minimum requirement for implementors of this method is that it work with objects from the cspace module. An implementation may support other classes, but if not then behaviour may be undefined when attempting to use such classes.

Implemented in csScriptObjectCommon.

virtual bool iScriptObject::SetPointer | ( | void * |  | ) | `[pure virtual]`

If the object is from the cspace module, this will allow you to change the reference to point to another object of the same class.

NOTE: This is not guaranteed to work, is deprecated, and will be removed!

Implemented in csScriptObjectCommon.

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

- ivaria/script.h