Script Constants
Details
Script constants are a way to define constants in scripts that can be reused in any script file (except for other script constants files).
In general, script constants can be used instead of the script macro operator @ that is file local.
Note that the script constants has a negligible load time impact and no runtime performance cost.
Like many other concepts, the script constant is only supported where explicitly stated that it is supported. However, all scoped variables
accepts script constants that are pointing to a single fixed point value, by using the prefix constant:.
Reloading
A script constant is a bit specific when it comes to reloading the database.
It's not enough to reload the script constant database itself since script constants are injected into the script on load.
Instead one have to first reload the script constant database, and then reload the database that uses the script constant.
Example
In the script constant file, the following constant file definition is made:
numeric_constants = {
schema = {
any_key = yes
data = fixed_point # floating point
}
pi = 3.14159
e = 2.71828
}These can then be used in a script file like this:
some_scoped_variable = constant:numeric_constants.pi
some_fixed_point_supporting_constants = numeric_constants.eSource: Script Concepts Documentation
- Name
- Type
- Script Concept