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

From Lavish Software Wiki
Jump to navigation Jump to search
 
Line 3: Line 3:
 
A Top-Level Object is simply an object -- where an [[LavishScript:Data Types|object type]] ''describes'' a type of object, a TLO ''is'' an 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.   
 
A Top-Level Object is simply an object -- where an [[LavishScript:Data Types|object type]] ''describes'' a type of object, a TLO ''is'' an 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.   
  
The term Top-Level Object is used to differentiate between objects that are a part of something else, and an object that can be immediately referred to.  [[TLO:String|String]] is a Top-Level Object, whereas string.Upper is a member object of the given [[datatype:string|string]].
+
The term Top-Level Object is used to differentiate between objects that are a part of something else, and an object that can be immediately referred to.  [[TLO:String|String]] is a Top-Level Object, whereas string.Upper is a member object of the given [[ObjectType:string|string]].
  
 
== Usage ==
 
== Usage ==
 
Basic usage of a Top-Level Object is like so: ${System}.  This simple form retrieves the object given by the [[TLO:System|System TLO]], which is the [[DataType:system|system object 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 object type.
 
Basic usage of a Top-Level Object is like so: ${System}.  This simple form retrieves the object given by the [[TLO:System|System TLO]], which is the [[DataType:system|system object 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 object 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 [[TLO:System|System TLO]] simply provides a way of accessing information about your system as described by the [[DataType:system|system object type]].  Lower-level objects are accessed via <tt>members</tt> of the system object type.  One such object is referred to as system.OS, and is a [[DataType:string|string]] type.  The string type then has members which can be accessed directly, such as string.Length.  As described in [[LavishScript:Syntax#Data|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.
+
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 [[TLO:System|System TLO]] simply provides a way of accessing information about your system as described by the [[DataType:system|system object type]].  Lower-level objects are accessed via <tt>members</tt> of the system object type.  One such object is referred to as system.OS, and is a [[ObjectType:string|string]] type.  The string type then has members which can be accessed directly, such as string.Length.  As described in [[LavishScript:Syntax#Data|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, escape the ${ portion of any Data Sequence, like \${String[xyz]}.
 
Nearly all commands allow parsing of data portions before the command itself is processed.  To prevent this from happening, escape the ${ portion of any Data Sequence, like \${String[xyz]}.

Latest revision as of 14:52, 14 October 2019

Introduction

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

A Top-Level Object is simply an object -- where an object type describes a type of object, a TLO is an 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.

The term Top-Level Object is used to differentiate between objects that are a part of something else, and an object that can be immediately referred to. String is a Top-Level Object, whereas string.Upper is a member object of the given string.

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 object 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 object 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 object type. Lower-level objects are accessed via members of the system object 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, escape the ${ portion of any Data Sequence, like \${String[xyz]}.

Built-in Top-Level Objects

LavishScript Top-Level Objects

Data Storage Conversion
Bool - Float - Int - String
Enums
Enum
Date/Time
Time
Events
Event
Inline Branching
If
Math
Math
Misc
Arg - Event - Execute - LavishScript - Script - Select - Type
Operating System
System
Scripting
QueuedCommands - Return - Variable - This - VariableScope - ForEach - Context

See Also