Difference between revisions of "LavishScript:Object Types"

From Lavish Software Wiki
Jump to navigation Jump to search
 
(35 intermediate revisions by 5 users not shown)
Line 1: Line 1:
 
== Terms ==
 
== Terms ==
 
* Member
 
* Member
: A ''member'' in the [[LavishScript]] context means a value associated with the datatype, referred to by a specific term
+
: 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 <tt>.</tt>
 
* Method
 
* Method
: A ''method'' in the [[LavishScript]] context means a function or action associated with the datatype, referred to by a specific term
+
: 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 <tt>:</tt>
 
* Index
 
* 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
+
: 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 <tt>[ ]</tt>, and separated by a <tt>,</tt>
 
* Inherit  
 
* Inherit  
: If a datatype ''inherits'' another, ''members'' and ''methods'' of the inherited datatype can be used as if they were of the original datatype, if not defined by the original datatype.
+
: 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 ==
 
== Introduction ==
 +
Object Types, also known as data types, are the complement to objects, including [[LavishScript:Top-Level Objects|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.
  
== Usage ==
+
== Vitals ==
 +
All object types have a number of <tt>vitals</tt> -- 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.
  
== Built-in Data Types ==
+
=== Inherits ===
=== Data Storage ===
+
This tells what object type or types a given object type <tt>inherits</tt>.  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).
; Text
+
 
* [[DataType:string|string]]
+
=== Reduces To ===
; Numbers
+
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.
* [[DataType:float|float]]
+
 
* [[DataType:int|int]]
+
=== Variable Object Type ===
* [[DataType:byte|byte]]
+
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 [[ObjectType:string|string]] object type is text that cannot be changed, and it reroutes variable creation to the [[ObjectType:mutablestring|mutablestring]] object type, which is text that ''can'' be changed.  The [[ObjectType:lavishscript|lavishscript]] object type is an example that simply refuses to create variables, as only one [[ObjectType:lavishscript|lavishscript]] object is necessary, and it is provided for you.
; Boolean
+
 
* [[DataType:bool|bool]]
+
=== Uses Sub-Types ===
; List
+
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".
* [[DataType:array|array]]
+
 
; Other
+
=== C/C++ Type ===
* [[DataType:rgb|rgb]]
+
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.  <tt>int</tt> means the value is a stored <tt>int</tt>, and <tt>int *</tt> means the value is a pointer to an <tt>int</tt>.  Not all of the C/C++ types are open source.
* [[DataType:time|time]]
+
 
* [[DataType:point3f|point3f]]
+
== Built-in Object Types ==
=== Utilities ===
+
{{LavishScript:Object_Types}}
* [[DataType:math|math]]
 
* [[DataType:system|system]]
 
* [[DataType:lavishscript|lavishscript]]
 
; Other
 
* [[DataType:type|type]]
 
  
 
== See Also ==
 
== See Also ==
 
* [[LavishScript:Top-Level Objects|Top-Level Objects]]
 
* [[LavishScript:Top-Level Objects|Top-Level Objects]]
 
* [[LavishScript:Variables|Variables]]
 
* [[LavishScript:Variables|Variables]]
 +
* [[LavishScript:Script-Defined Object Types|Script-Defined Object Types]]
 +
[[Category:LavishScript]]
 +
[[Category:Object Types]]
 +
[[Category:LavishScript Data Types]]

Latest revision as of 14:51, 8 July 2018

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

LavishScript Object Types

See Also