From 94e11ad2a01ec5932226991e6dff6a75ca2b02b9 Mon Sep 17 00:00:00 2001 From: Michael Liebmann Date: Fri, 13 Nov 2015 23:13:31 +0100 Subject: [PATCH] CLuaInstance: Add script function 'zapitSetStandby' - Necessary for some video plugins - Set Lua api version to 1.7 Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/6f66e21940eb2dae87916ce0d0dd803de6303d6e Author: Michael Liebmann Date: 2015-11-13 (Fri, 13 Nov 2015) ------------------ This commit was generated by Migit --- src/gui/luainstance.cpp | 12 ++++++++++++ src/gui/luainstance.h | 3 ++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/src/gui/luainstance.cpp b/src/gui/luainstance.cpp index e98fca087..2662476df 100644 --- a/src/gui/luainstance.cpp +++ b/src/gui/luainstance.cpp @@ -471,6 +471,7 @@ void CLuaInstance::runScript(const char *fileName, std::vector *arg if (error_string) *error_string = std::string(lua_tostring(lua, -1)); } + g_Zapit->setStandby(false); } // Example: runScript(fileName, "Arg1", "Arg2", "Arg3", ..., NULL); @@ -523,6 +524,7 @@ const luaL_Reg CLuaInstance::methods[] = { "setBlank", CLuaInstance::setBlank }, { "ShowPicture", CLuaInstance::ShowPicture }, { "StopPicture", CLuaInstance::StopPicture }, + { "zapitSetStandby", CLuaInstance::zapitSetStandby }, { "Blit", CLuaInstance::Blit }, { "GetLanguage", CLuaInstance::GetLanguage }, { "runScript", CLuaInstance::runScriptExt }, @@ -712,6 +714,16 @@ int CLuaInstance::StopPicture(lua_State */*L*/) return 0; } +int CLuaInstance::zapitSetStandby(lua_State *L) +{ + bool standby = true; + int numargs = lua_gettop(L); + if (numargs > 1) + standby = _luaL_checkbool(L, 2); + g_Zapit->setStandby(standby); + return 0; +} + int CLuaInstance::PlayFile(lua_State *L) { printf("CLuaInstance::%s %d\n", __func__, lua_gettop(L)); diff --git a/src/gui/luainstance.h b/src/gui/luainstance.h index e670b2237..58a346822 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 6 +#define LUA_API_VERSION_MINOR 7 /* this is stored as userdata in the lua_State */ struct CLuaData @@ -230,6 +230,7 @@ private: static int setBlank(lua_State *L); static int ShowPicture(lua_State *L); static int StopPicture(lua_State *L); + static int zapitSetStandby(lua_State *L); static int PlayFile(lua_State *L); static int strFind(lua_State *L);