Difference between revisions of "LavishScript:Top-Level Objects"

From Lavish Software Wiki
Jump to navigation Jump to search
Line 9: Line 9:
  
 
Nearly all commands allow parsing of data portions before the command itself is processed.  To prevent this from happening, make use of the [[Command:NoParse|NoParse command]].
 
Nearly all commands allow parsing of data portions before the command itself is processed.  To prevent this from happening, make use of the [[Command:NoParse|NoParse command]].
 +
 +
== Describing Usage ==
 +
''(note: This refers to discussions, rather than actual usage syntax. see [[LavishScript:Syntax|Syntax]])''<br>
 +
When discussing Top-Level Objects, the resulting data types and their members or methods, it is prudent to to remember that a Top-Level Object is just a way to access a given object of a given data type.  ''Top-Level Objects do not have members!''  Thus, you only want to describe a TLO when you must describe a specific object, rather than something that affects all of a given type of object.  If you want to describe something that affects all of a given data type, discuss the actual data type instead.
 +
 +
When describing usage of a Top-Level Object, the name of the TLO in its original capitalized form is used.  This is because data types are usually all lower-case, and this is how to differentiate between talking about [[DataType:string|string]], the data type, and [[TLO:String|String]], the TLO.  Additionally, most TLOs, including String, use an ''index'', making it incorrect to describe String.Arg.  It would be correct to describe string.Arg or String[].Arg.
 +
 +
; A single object
 +
* Object
 +
* Object[index]
 +
; Accessing Members
 +
* type.Member
 +
* type.Member[index]
 +
; Accessing Methods
 +
* type:Method
 +
* type:Method[index]
  
 
== Built-in Top-Level Objects ==
 
== Built-in Top-Level Objects ==

Revision as of 04:47, 24 March 2005

Introduction

Difficulty Rating
Top-Level Objects
Usage Beginner
Level of Understanding Intermediate
Computer Savvy Newbie
Logic Intermediate

Top-Level Objects (TLOs) are the complement to Data Types. Where a a data type describes a type of object, a TLO is a specific object. For example, "table" would be a data type, but "my dining table" would be an object. Everything said about "my dining table" can generally be said about every other table. Thus, a data 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.

Usage

Basic usage of a Top-Level Object is like so: ${System}. This simple form retrieves the object given by the System TLO, which is the system data type. Because the usage ends immediately with a }, the entire ${System} part of the text is replaced with the default value given by the system data type.

A Top-Level Object is described as Top-Level simply because it provides a starting point for accessing data. This does imply that there are lower level objects, accessible through a TLO. For example, the System TLO simply provides a way of accessing information about your system as described by the system data type. Lower-level objects are accessed via members of the system data type. One such object is referred to as system.OS, and is a string type. The string type then has members which can be accessed directly, such as string.Length. As described in Data Syntax, the usage is recursive, and each member results in an entirely new object for which the form can be continued. This means that instead of ${String[${System.OS}].Length}, you should simply use ${System.OS.Length}, because system.OS is a string.

Nearly all commands allow parsing of data portions before the command itself is processed. To prevent this from happening, make use of the NoParse command.

Describing Usage

(note: This refers to discussions, rather than actual usage syntax. see Syntax)
When discussing Top-Level Objects, the resulting data types and their members or methods, it is prudent to to remember that a Top-Level Object is just a way to access a given object of a given data type. Top-Level Objects do not have members! Thus, you only want to describe a TLO when you must describe a specific object, rather than something that affects all of a given type of object. If you want to describe something that affects all of a given data type, discuss the actual data type instead.

When describing usage of a Top-Level Object, the name of the TLO in its original capitalized form is used. This is because data types are usually all lower-case, and this is how to differentiate between talking about string, the data type, and String, the TLO. Additionally, most TLOs, including String, use an index, making it incorrect to describe String.Arg. It would be correct to describe string.Arg or String[].Arg.

A single object
  • Object
  • Object[index]
Accessing Members
  • type.Member
  • type.Member[index]
Accessing Methods
  • type:Method
  • type:Method[index]

Built-in Top-Level Objects

Data Storage Conversion

Use these only when necessary, they do not generally need to be used at all! (see Usage)

Other

See Also