Difference between revisions of "love.getVersion"

(Added a note about love._version_minor etc.)
m (Remove semicolons)
Line 27: Line 27:
 
<source lang="lua">
 
<source lang="lua">
 
function love.draw()
 
function love.draw()
     local major, minor, revision, codename = love.getVersion();
+
     local major, minor, revision, codename = love.getVersion()
     local str = string.format("Version %d.%d.%d - %s", major, minor, revision, codename);
+
     local str = string.format("Version %d.%d.%d - %s", major, minor, revision, codename)
     love.graphics.print(str, 20, 20);
+
     love.graphics.print(str, 20, 20)
 
end
 
end
 
</source>
 
</source>

Revision as of 12:19, 6 September 2015

Available since LÖVE 0.9.1
This function is not supported in earlier versions.

Gets the current running version of LÖVE.

Function

Synopsis

major, minor, revision, codename = love.getVersion( )

Arguments

None.

Returns

number major
The major version of LÖVE, i.e. 0 for version 0.9.1.
number minor
The minor version of LÖVE, i.e. 9 for version 0.9.1.
number revision
The revision version of LÖVE, i.e. 1 for version 0.9.1.
string codename
The codename of the current version.

Notes

For LÖVE versions below 0.9.1, the following variables can be used instead:

love._version_major
love._version_minor
love._version_revision

Examples

display the current version

function love.draw()
    local major, minor, revision, codename = love.getVersion()
    local str = string.format("Version %d.%d.%d - %s", major, minor, revision, codename)
    love.graphics.print(str, 20, 20)
end

See Also

Other Languages