Version

From Riftui Wiki

Jump to: navigation, search
This article is about the RiftAddon.toc Version variable. For the Lua VERSION constant, see VERSION.

Version is a string variable in the RiftAddon.toc file that indicates the current version of the Addon.

Contents

Examples

Version = "1.0"
Version = "1.9"
Version = "3.4 beta"

Version Determination

The technical process

Split the version into "numeric" and "alphabetical" tokens. Whitespace and the character '.' are stripped entirely and used for delimeters between tokens. If the version is prefixed by "v", "ver", or "version", remove that token entirely. The token arrays are then lexicographically compared. Numeric tokens are considered to be greater than alphabetical tokens. Comparing an alphabetical token to another alphabetical token is done lexicographically, comparing a numeric token to another numeric token is done numerically. Therefore "1.10" is considered to be a higher version than "1.9", and "1.4 beta" is considered to be lower than "1.4.0". Be warned: "1.4 beta" is currently a higher version than "1.4".)

How It Works

For those that have trouble following the official explanation, here are some examples and how they break down.

Version1 = "v1.4"
arrayVersion1 = 1, 4
 
Version2 = "1.4 beta"
arrayVersion2 = 1, 4, "beta"
 
Version3 = "1.4.0"
arrayVersion3 = 1, 4, 0
 
Version4 = "1.10"
arrayVersion4 = 1, 10

Versions will sort as follows (highest to lowest):

Why? Comparing the first element of each array, they all are equal, so the first element gives us nothing by which to sort the information. In the second element, 10 > 4, therefore 1.10 evaluates as a higher version number than the others. The remaining versions are equal in the second element, so the system looks at the third element. In the third element, 0 > "beta" because numerical tokens are considered higher than alphanumeric, so 1.4.0 becomes the second element. Finally, 1.4 contains a null for the third array element, so "beta" > null, making 1.4 beta the third highest version, with 1.4 being the lowest version in the list.

Personal tools
Namespaces
Variants
Actions
Menu
Wiki
Toolbox