Difference between revisions of "Property Reference"
m
→Auto Property: Corrected a few typos, and an incomplete sentence. Tweaked some wording, eliminating some redundancy in one case, and a plural/singular disagreement in another.
imported>Homecom m (→Auto Read-Only Property: Corrected a few typos, fixed an incomplete sentence, and shaved a few words off a couple of sentences.) |
imported>Homecom m (→Auto Property: Corrected a few typos, and an incomplete sentence. Tweaked some wording, eliminating some redundancy in one case, and a plural/singular disagreement in another.) |
||
(One intermediate revision by the same user not shown) | |||
Line 40: | Line 40: | ||
<auto property> ::= <type> 'Property' <identifier> ['=' <constant>] 'Auto' <flags>* | <auto property> ::= <type> 'Property' <identifier> ['=' <constant>] 'Auto' <flags>* | ||
An auto property is, for all intents and purposes, a public variable. It will create a hidden variable and hidden get and set functions that manipulate it, so you don't have to. It may optionally be initialized with a value using the same syntax as an object variable. (There are also | An auto property is, for all intents and purposes, a public variable. It will create a hidden variable and hidden get and set functions that manipulate it, so you don't have to. It may optionally be initialized with a value using the same syntax as an object variable. (There are also internal optimizations that make these properties more efficient than the "full" type.) | ||
Auto properties may not be defined in native scripts | Auto properties may not be defined in native scripts. | ||
An auto property | An auto property is made immutable by adding "Const" to the end of the definition line. The value of a "Const" property can only be set in the editor, so any value recorded in a save game will be ignored, allowing changes to the master file to override save game data. | ||
=== Examples === | === Examples === | ||
Line 55: | Line 55: | ||
<auto read-only property> ::= <type> 'Property' <identifier> '=' <constant> 'AutoReadOnly' <flags>* | <auto read-only property> ::= <type> 'Property' <identifier> '=' <constant> 'AutoReadOnly' <flags>* | ||
An auto read-only property is simply a publicly accessible value that cannot be changed. For obvious reasons, it must be assigned a value when declared. (There are also internal optimizations that these properties more efficient than other properties.) | An auto read-only property is simply a publicly accessible value that cannot be changed. For obvious reasons, it must be assigned a value when declared. (There are also internal optimizations that make these properties more efficient than other properties.) | ||
=== Examples === | === Examples === |