Added love.getVersion (resolves issue #809).

Syntax is: major, minor, revision, codename = love.getVersion().
This commit is contained in:
Alex Szpakowski
2014-01-27 19:24:14 -04:00
parent 0f9bf64cf8
commit a2a8b14cfd
+12
View File
@@ -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)