mirror of
https://github.com/love2d/love.git
synced 2026-08-17 11:00:31 +02:00
Added love.getVersion (resolves issue #809).
Syntax is: major, minor, revision, codename = love.getVersion().
This commit is contained in:
@@ -170,6 +170,15 @@ const char *love_codename()
|
|||||||
return love::VERSION_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)
|
int luaopen_love(lua_State * L)
|
||||||
{
|
{
|
||||||
love::luax_insistglobal(L, "love");
|
love::luax_insistglobal(L, "love");
|
||||||
@@ -203,6 +212,9 @@ int luaopen_love(lua_State * L)
|
|||||||
|
|
||||||
lua_setfield(L, -2, "_version_compat");
|
lua_setfield(L, -2, "_version_compat");
|
||||||
|
|
||||||
|
lua_pushcfunction(L, w_love_getVersion);
|
||||||
|
lua_setfield(L, -2, "getVersion");
|
||||||
|
|
||||||
#ifdef LOVE_WINDOWS
|
#ifdef LOVE_WINDOWS
|
||||||
lua_pushstring(L, "Windows");
|
lua_pushstring(L, "Windows");
|
||||||
#elif defined(LOVE_MACOSX)
|
#elif defined(LOVE_MACOSX)
|
||||||
|
|||||||
Reference in New Issue
Block a user