Difference between revisions of "LavishScript:Top-Level Objects"
(→Other) |
|||
(24 intermediate revisions by 3 users not shown) | |||
Line 1: | Line 1: | ||
== Introduction == | == Introduction == | ||
+ | {{LoU|Top-Level Objects|Beginner|Intermediate|Newbie|Intermediate}} | ||
+ | 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 [[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. | ||
+ | |||
+ | 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]}. | ||
== Built-in Top-Level Objects == | == Built-in Top-Level Objects == | ||
− | + | {{LavishScript:Top-Level_Objects}} | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
== See Also == | == See Also == | ||
− | * [[LavishScript:Data Types| | + | * [[LavishScript:Data Types|Object Types]] |
* [[LavishScript:Variables|Variables]] | * [[LavishScript:Variables|Variables]] | ||
+ | |||
+ | [[Category:LavishScript]] |
Latest revision as of 14:52, 14 October 2019
Introduction
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