NET:LavishScriptAPI.LavishScriptObject

From Lavish Software Wiki
Revision as of 07:08, 4 December 2006 by Lax (talk | contribs)
(diff) ←Older revision | view current revision (diff) | Newer revision→ (diff)
Jump to navigation Jump to search

Overview

The LavishScriptObject class holds object information for the remaining duration of the current frame. You must use frame locking to ensure that the object is valid for the duration of usage. After the frame completes, the LavishScriptObject's internal data will be invalidated automatically, and usage of its methods will fail. LavishScriptObjects can be retrieved by LavishScript.Objects.GetObject, LavishScriptObject.GetMember, LavishScriptObject.GetIndex and LavishScriptObject.GetLSType (and by inference, any functions that call these functions and return a retrieved object...).

Subclassing

The LavishScriptObject class provides a base class from which to create .NET equivalents for LavishScript objects. Every LavishScript object can be represented by a .NET object. The data inside a LavishScriptObject is a black box, and that black box will be destroyed at the end of a frame, causing its members to return a null or default value -- except for permanent objects and objects created by you. It is perfectly safe to copy a LavishScriptObject, and a copy constructor is provided that accepts a LavishScriptObject parameter, for which null is a valid value. The data stored in the black box is a token representing the object data (either the value for a value type, or a reference for a reference type), and a token representing the object type (such as string, int, collection, and so on). Because the real type is stored in the black box, it is reasonably safe to attempt to access LavishScript object members and methods as if it were any LavishScript type.

Members

  • public LavishScriptObject(LavishScriptObject Copy) -- copy constructor
  • public LavishScriptObject GetMember(string Member)
  • public LavishScriptObject GetMember(string Member, string[] args)
  • public LavishScriptObject GetIndex(string[] args)
  • public bool ExecuteMethod(string Method)
  • public bool ExecuteMethod(string Method, string[] args)
  • public T GetValue<T>()
  • public override string ToString() -- same as GetValue<string>
  • public LavishScriptObject GetLSType()
  • public T GetLSType<T>()

See Also

Inner Space .NET