From 24881e4228a97be506bc9f83c7d28ee3396b6d0a Mon Sep 17 00:00:00 2001 From: "M. Liebmann" Date: Sat, 14 Nov 2015 19:15:03 +0100 Subject: [PATCH] CLuaInstance: Add screen constants 'X_RES' and 'Y_RES' - Set Lua api version to 1.9 --- src/gui/luainstance.cpp | 4 ++++ src/gui/luainstance.h | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/gui/luainstance.cpp b/src/gui/luainstance.cpp index a0785436c..6ea65173d 100644 --- a/src/gui/luainstance.cpp +++ b/src/gui/luainstance.cpp @@ -262,12 +262,16 @@ static void set_lua_variables(lua_State *L) }; /* screen offsets, exported as e.g. SCREEN['END_Y'] */ + lua_Integer xRes = (lua_Integer)CFrameBuffer::getInstance()->getScreenWidth(true); + lua_Integer yRes = (lua_Integer)CFrameBuffer::getInstance()->getScreenHeight(true); table_key screenopts[] = { { "OFF_X", g_settings.screen_StartX }, { "OFF_Y", g_settings.screen_StartY }, { "END_X", g_settings.screen_EndX }, { "END_Y", g_settings.screen_EndY }, + { "X_RES", xRes }, + { "Y_RES", yRes }, { NULL, 0 } }; table_key menureturn[] = diff --git a/src/gui/luainstance.h b/src/gui/luainstance.h index 1c0887d72..99bd0b4b0 100644 --- a/src/gui/luainstance.h +++ b/src/gui/luainstance.h @@ -34,7 +34,7 @@ extern "C" { #include #define LUA_API_VERSION_MAJOR 1 -#define LUA_API_VERSION_MINOR 8 +#define LUA_API_VERSION_MINOR 9 /* this is stored as userdata in the lua_State */ struct CLuaData