NET:LavishScriptAPI.LavishScriptPersistentObject

From Lavish Software Wiki
Jump to navigation Jump to search

Overview

The LavishScriptPersistentObject class holds object information for the entire lifetime of the referenced object. As with LavishScriptObject, you must still use frame locking to ensure that the execution context is valid when accessing members and methods. When the referenced object is destroyed, the LavishScriptPersistentObject's internal data will be invalidated automatically, and usage of its methods will fail. The IsValid property can be used to determine if the referenced object is valid. LavishScriptPersistentObjects can be retrieved by LavishScript.Objects.GetPersistentObject, GetPersistentMember, GetPersistentIndex (and by inference, any functions that call these functions and return a retrieved object...).

Only LavishScript types that support object persistence can be used with LavishScriptPersistentObject. All others must be used with LavishScriptObject.

Subclassing

The LavishScriptPersistentObject class provides a base class from which to create .NET equivalents for LavishScript objects. Every LavishScript object can be represented by a .NET object between LavishScriptPersistentObject and LavishScriptObject. Similar to LavishScriptObject, the data inside a LavishScriptPersistentObject is a black box, and that black box will be destroyed at the end of the object's lifetime, causing its members to return a null or default value. It is perfectly safe to copy a LavishScriptPersistentObject, and a copy constructor is provided that accepts a LavishScriptPersistentObject 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

All members are used 100% identically to LavishScriptObject members, and therefore the documentation for each will reference the LavishScriptObject documentation.
  • public LavishScriptObject(LavishScriptObject Copy) -- copy constructor
  • public LavishScriptObject GetMember(string Member)
  • public LavishScriptObject GetMember(string Member, params string[] args)
  • public LavishScriptObject GetIndex(params string[] args)

See Also