Difference between revisions of "Oolite JavaScript Reference: Oolite"
m (Added Oolite scripting category.) |
m (Cleanup.) |
||
Line 9: | Line 9: | ||
=== <code>jsVersion</code> === |
=== <code>jsVersion</code> === |
||
'''jsVersion''' : Number (read-only) |
'''jsVersion''' : Number (read-only) |
||
− | The version of the JavaScript language implemented by this version of Oolite, multiplied by 100, as an integer. For instance, for [http://developer.mozilla.org/en/docs/New_in_JavaScript_1.7 JavaScript 1.7] ( |
+ | The version of the JavaScript language implemented by this version of Oolite, multiplied by 100, as an integer. For instance, for [http://developer.mozilla.org/en/docs/New_in_JavaScript_1.7 JavaScript 1.7] (used in Oolite 1.70), this will be equal to <code>170</code>. |
=== <code>jsVersion</code> === |
=== <code>jsVersion</code> === |
||
Line 19: | Line 19: | ||
The version of Oolite, as an array of version components. For instance, for Oolite 1.70 this will be equal to <code>[1, 70]</code>. For a hypothetical version 1.70.1, it will be equal to <code>[1, 70, 1]</code>. |
The version of Oolite, as an array of version components. For instance, for Oolite 1.70 this will be equal to <code>[1, 70]</code>. For a hypothetical version 1.70.1, it will be equal to <code>[1, 70, 1]</code>. |
||
+ | === <code>versionString</code> === |
||
'''versionString''' : String (read-only) |
'''versionString''' : String (read-only) |
||
The version of Oolite, as a string. For instance, for Oolite 1.70 this will be equal to <code>"1.70"</code>. For a hypothetical version 1.70.1, it will be equal to <code>"1.70.1"</code>. |
The version of Oolite, as a string. For instance, for Oolite 1.70 this will be equal to <code>"1.70"</code>. For a hypothetical version 1.70.1, it will be equal to <code>"1.70.1"</code>. |
||
Line 24: | Line 25: | ||
== Methods == |
== Methods == |
||
− | === compareVersion === |
+ | === <code>compareVersion</code> === |
− | + | '''compareVersion'''(versionSpec) : Number |
|
Compare the version of Oolite to <code>versionSpec</code>, which may be either a string or an array (in the format given by <code>[[#version|version]]</code>). If the current version of Oolite is less than <code>versionSpec</code>, -1 is returned. If the current version of Oolite is greater than <code>versionSpec</code>, 1 is returned. If they are equal, 0 is returned. Example: |
Compare the version of Oolite to <code>versionSpec</code>, which may be either a string or an array (in the format given by <code>[[#version|version]]</code>). If the current version of Oolite is less than <code>versionSpec</code>, -1 is returned. If the current version of Oolite is greater than <code>versionSpec</code>, 1 is returned. If they are equal, 0 is returned. Example: |
||
if (oolite.compareVersion("1.80") < 0) |
if (oolite.compareVersion("1.80") < 0) |
Revision as of 18:40, 6 December 2007
Prototype: Object
Subtypes: none
This class was added in Oolite test release 1.70.
The Oolite
class represents Oolite itself. It allows scripts to access information about the application. There is a global instance of Oolite
, named oolite
.
Contents
Properties
jsVersion
jsVersion : Number (read-only)
The version of the JavaScript language implemented by this version of Oolite, multiplied by 100, as an integer. For instance, for JavaScript 1.7 (used in Oolite 1.70), this will be equal to 170
.
jsVersion
jsVersionString : String (read-only)
The version of the JavaScript language implemented by this version of Oolite, as a string. For instance, for JavaScript 1.7, this will be equal to "1.7"
.
version
version : Array (read-only)
The version of Oolite, as an array of version components. For instance, for Oolite 1.70 this will be equal to [1, 70]
. For a hypothetical version 1.70.1, it will be equal to [1, 70, 1]
.
versionString
versionString : String (read-only)
The version of Oolite, as a string. For instance, for Oolite 1.70 this will be equal to "1.70"
. For a hypothetical version 1.70.1, it will be equal to "1.70.1"
.
Methods
compareVersion
compareVersion(versionSpec) : Number
Compare the version of Oolite to versionSpec
, which may be either a string or an array (in the format given by version
). If the current version of Oolite is less than versionSpec
, -1 is returned. If the current version of Oolite is greater than versionSpec
, 1 is returned. If they are equal, 0 is returned. Example:
if (oolite.compareVersion("1.80") < 0) { // Oolite version is older than 1.80. Log("An old version of Oolite (" + oolite.versionString + ") is in use. Some features of SuperDuperOXP will not be available.") } else { // Enable advanced features here. }