Difference between revisions of "Property Reference"

51 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>Homecom
m (→‎Auto Read-Only Property: Corrected a typo of my own.)
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.)
 
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 ===
Anonymous user