|
Drag[en]gine Script Module DragonScript 1.35
|
Stores named parameters in a table. More...
Public Member Functions | |
| void | clear () |
| Clear parameter table. | |
| ParameterTableEntry | find (Block ablock) |
| Find parameter. | |
| void | forEach (Block ablock) |
| Visit parameters with block with ParameterTableEntry as parameter. | |
| ParameterTableEntry | getAt (String name) |
| Get parameter adding it if absent. | |
| ParameterTableEntry | getAtOrNull (String name) |
| Get parameter or null if absent. | |
| int | getCount () |
| Count of parameters. | |
| Array | getNames () |
| List of all parameter names as Array of String. | |
| bool | has (String name) |
| Parameter is present. | |
| ParameterTable | new () |
| Create parameter table. | |
| void | remove (String name) |
| Remove parameter. | |
| void | removeAll () |
| Remove all parameters. | |
| void | removeIfPresent (String name) |
| Remove parameter if present. | |
| void | writeToFile (PersistencyEnvironment env, FileWriter writer) |
| Write parameter table to file. | |
Public Attributes | |
| Dictionary | pParameters |
| Parameters. | |
Stores named parameters in a table.
Allows to store parameter with primitive or persistable type for game elements or global game state. Parameter tables are sometimes called "Black boards". Various game scripts can set values in a table while other game scripts can read the values from the table without the individual systems knowing each other. For performance reasons the entries in the table are queried and can be stored locally to avoid looking them up all the time. In addition to primitive values parameters support objects implementing the Persistable interface. This allows parameter tables to be stored in save states easily. Parameter values are cleared by setting them to null. This avoids the need to remove parameters from the table.
The parameter table is a pure storage facility. No notifications about changes to parameter values is done in any way. If you need tracking state changes use TSTriggerTable or the EventTracker.
| void Dragengine.ParameterTable.clear | ( | ) |
| ParameterTableEntry Dragengine.ParameterTable.find | ( | Block | ablock | ) |
Find parameter.
Block receives argument ParameterTableEntry and returns bool if matching entry is found.
Referenced by writeToFile().
| void Dragengine.ParameterTable.forEach | ( | Block | ablock | ) |
Visit parameters with block with ParameterTableEntry as parameter.
References pParameters.
Referenced by writeToFile().
| ParameterTableEntry Dragengine.ParameterTable.getAt | ( | String | name | ) |
| ParameterTableEntry Dragengine.ParameterTable.getAtOrNull | ( | String | name | ) |
Get parameter or null if absent.
Referenced by removeAll().
| int Dragengine.ParameterTable.getCount | ( | ) |
| Array Dragengine.ParameterTable.getNames | ( | ) |
List of all parameter names as Array of String.
References pParameters, and removeAll().
Referenced by writeToFile().
| bool Dragengine.ParameterTable.has | ( | String | name | ) |
Parameter is present.
Referenced by getAt().
| ParameterTable Dragengine.ParameterTable.new | ( | ) |
| void Dragengine.ParameterTable.remove | ( | String | name | ) |
Remove parameter.
References getAt(), and pParameters.
| void Dragengine.ParameterTable.removeAll | ( | ) |
| void Dragengine.ParameterTable.removeIfPresent | ( | String | name | ) |
| void Dragengine.ParameterTable.writeToFile | ( | PersistencyEnvironment | env, |
| FileWriter | writer ) |
Write parameter table to file.
References find(), forEach(), getCount(), getNames(), pParameters, and writeToFile().
Referenced by writeToFile().
| Dictionary Dragengine.ParameterTable.pParameters |
Parameters.
Referenced by clear(), forEach(), getAt(), getNames(), new(), remove(), removeAll(), and writeToFile().