Difference between revisions of "Property Reference"

93 bytes removed ,  20:34, 20 June 2018
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>Plplecuyer
 
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.)
 
(2 intermediate revisions 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 some internal optimizations that make this kind of property more efficient to use then the full type if you don't need limitations)
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 may be defined as 'const' by adding "Const" to the end of the definition line. Const properties can only have their value set in the editor and any value given them in a save game will be ignored, allowing changes to the master file to override the save game.
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>*


Au auto read-only property is simply a publicly accessible value that cannot be changed. For obvious reasons, it must be initialized with a value when declared. (There are also some internal optimizations that make this kind of property more efficient to use then the full type if you don't need to)
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 ===
Anonymous user