LavishScript:Object Types

From Lavish Software Wiki
(Redirected from LavishScript:Data Types)
Jump to: navigation, search

Terms

  • Member
A member in the LavishScript context means an object associated with the object type, referred to by a specific term. Members are accessed with a .
  • Method
A method in the LavishScript context means a function or action associated with the object type, referred to by a specific term. Methods are accessed with a :
  • Index
An index in the LavishScript context means a value or set of values that, when used with a member or method, indicates parameters such as coordinates to be used in retrieving a value or taking an action. Indices are surrounded with [ ], and separated by a ,
  • Inherit
If an object type inherits another, members and methods of the inherited datatype can be used as if they were of the original object type, if not defined by the original object type.

Introduction

Object Types, also known as data types, are the complement to objects, including Top-Level Objects (TLOs) and Variables. Where a variable is a specific object, an object type describes a class of objects (i.e. the type of object). For example, "table" would be an object type, but "my dining table" would be an object. Everything said about "my dining table" can generally be said about every other table. Thus, an object type is a generalized way of describing many objects. Using this generalization makes it relatively easy to work with a large number of objects, because they are all described in the same way, and that's the idea behind object types.

Vitals

All object types have a number of vitals -- important properties or information -- besides their members or methods.

Defined By

This tells what product, library, extension, module, etc is responsible for interaction with the given object type, and therefore where you might look to find further information relating to that object type.

Inherits

This tells what object type or types a given object type inherits. To repeat what is described above, this means that an object of this type will have all members or methods of the inherited type, and all members or methods of whatever the inherited type inherits (and so on).

Reduces To

At the end of a data sequence, the entire sequence including the ${} is reduced to text, another way of saying that the entire sequence is replaced (in place) with the "Reduced To" value of the final object in the sequence.

Variable Object Type

When creating a new variable with a given object type, that object type may reroute the creation to a different object type, or it may refuse to create variables altogether. For example, the string object type is text that cannot be changed, and it reroutes variable creation to the mutablestring object type, which is text that can be changed. The lavishscript object type is an example that simply refuses to create variables, as only one lavishscript object is necessary, and it is provided for you.

Uses Sub-Types

Some object types require the use of sub-types in order to create a variable. A sub-type generally means that the object is a container for some other type of object. You don't just have "an index", you have "an index of strings" for example. Sub-types are used by adding : and then the sub-type to the original object type when creating a variable, such as "index:string" or "index:int".

C/C++ Type

The C/C++ Type is only useful to C/C++ developers, so anyone else should probably ignore this entirely. An object in LavishScript is simply a 32-bit value, paired with a pointer to an LSTypeDefinition representing the object type (this tells LavishScript how it can access the value). In this fashion, pretty much any C/C++ datatype is available (structures larger than 32-bits must of course be referred to by a pointer). Therefore, the 32-bit value is always going to be the immediate value or a pointer to an instance of a given structure or class. The C/C++ Type given in Object Type Vitals is going to be the datatype of the stored value. int means the value is a stored int, and int * means the value is a pointer to an int. Not all of the C/C++ types are open source.

Built-in Object Types

Data Storage

Text

Numbers

Boolean (TRUE/FALSE)

Pointers

Containers

Iteration

Date and Time

Other

File Handling

Utilities

See Also