From a2a8b14cfd53529bcc13b146598b45f4f8f07c45 Mon Sep 17 00:00:00 2001 From: Alex Szpakowski Date: Mon, 27 Jan 2014 19:24:14 -0400 Subject: [PATCH] Added love.getVersion (resolves issue #809). Syntax is: major, minor, revision, codename = love.getVersion(). --- src/modules/love/love.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/modules/love/love.cpp b/src/modules/love/love.cpp index 77fe5b208..7bb700b76 100644 --- a/src/modules/love/love.cpp +++ b/src/modules/love/love.cpp @@ -170,6 +170,15 @@ const char *love_codename() return love::VERSION_CODENAME; } +static int w_love_getVersion(lua_State *L) +{ + lua_pushinteger(L, love::VERSION_MAJOR); + lua_pushinteger(L, love::VERSION_MINOR); + lua_pushinteger(L, love::VERSION_REV); + lua_pushstring(L, love::VERSION_CODENAME); + return 4; +} + int luaopen_love(lua_State * L) { love::luax_insistglobal(L, "love"); @@ -203,6 +212,9 @@ int luaopen_love(lua_State * L) lua_setfield(L, -2, "_version_compat"); + lua_pushcfunction(L, w_love_getVersion); + lua_setfield(L, -2, "getVersion"); + #ifdef LOVE_WINDOWS lua_pushstring(L, "Windows"); #elif defined(LOVE_MACOSX)