extension_get_version

This functions gets the version of an Extension Asset with the given name, and returns it as a string formatted as "major.minor.revision".

 

Syntax:

extension_get_version(ext_name);

ArgumentTypeDescription
extension_nameStringThe name of the extension

 

Returns:

String

 

Example:

var _version_string = extension_get_version("MyExtension");
var _values = string_split(_version_string, ".");
var _major = _values[0], _minor = _values[1], _revision = _values[2];
show_debug_message($"Version: {_ver}\nMajor: {_major}\nMinor: {_minor}\nRevision:{_revision}");
if (_major < 1)
{
    show_debug_message("At least version 1 of the extension is required.");
    game_end();
}

The above code first calls extension_get_version to get a string containing the version number of an extension named "MyExtension". It stores the returned value in a temporary variable _version_string and calls string_split on that to get the major and minor version number, as well as the revision number. These are assigned to the temporary variables _major, _minor and _revision respectively. A debug message shows this information. Finally the major version number is checked; if it is too low a debug message is output and the game is ended by calling game_end.