From Lavish Software Wiki
Jump to: navigation, search


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. The IsValid property can be used to determine if the object reference is valid. 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...).

Exceptions to the rule

LavishScriptObjects can also represent a LavishScript variable, when created with LavishScript.Objects.NewObject. When the LavishScriptObject is a LavishScript variable, the object is valid until explicitly invalidated.

Persistent references for non-variable types can be used via the LavishScriptPersistentObject class.


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 objects created by you (which represent a LavishScript variable; see "Exceptions to the rule" above). 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.


  • 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