diff --git a/src/gui/lua/lua_misc.cpp b/src/gui/lua/lua_misc.cpp index 072b44802..fca56c1c2 100644 --- a/src/gui/lua/lua_misc.cpp +++ b/src/gui/lua/lua_misc.cpp @@ -57,6 +57,7 @@ void CLuaInstMisc::LuaMiscRegister(lua_State *L) { "runScript", CLuaInstMisc::runScriptExt }, { "GetRevision", CLuaInstMisc::GetRevision }, { "checkVersion", CLuaInstMisc::checkVersion }, + { "postMsg", CLuaInstMisc::postMsg }, { "__gc", CLuaInstMisc::MiscDelete }, { NULL, NULL } }; @@ -198,6 +199,22 @@ int CLuaInstMisc::checkVersion(lua_State *L) return 1; } +int CLuaInstMisc::postMsg(lua_State *L) +{ + lua_Integer msg = 0; + neutrino_msg_t post_msg = 0; + msg = luaL_checkint(L, 2); + switch (msg) { + case POSTMSG_STANDBY_ON: + post_msg = NeutrinoMessages::STANDBY_ON; + break; + default: + return 0; + } + g_RCInput->postMsg(post_msg, 0); + return 0; +} + int CLuaInstMisc::MiscDelete(lua_State *L) { CLuaMisc *D = MiscCheckData(L, 1); diff --git a/src/gui/lua/lua_misc.h b/src/gui/lua/lua_misc.h index 3c6d7b55c..551c40443 100644 --- a/src/gui/lua/lua_misc.h +++ b/src/gui/lua/lua_misc.h @@ -31,6 +31,10 @@ class CLuaMisc class CLuaInstMisc { public: + enum { + POSTMSG_STANDBY_ON = 1 + }; + CLuaInstMisc() {}; ~CLuaInstMisc() {}; static CLuaInstMisc* getInstance(); @@ -53,6 +57,7 @@ class CLuaInstMisc static int runScriptExt(lua_State *L); static int GetRevision(lua_State *L); static int checkVersion(lua_State *L); + static int postMsg(lua_State *L); static int MiscDelete(lua_State *L); static void miscFunctionDeprecated(lua_State *L, std::string oldFunc); diff --git a/src/gui/lua/luainstance.cpp b/src/gui/lua/luainstance.cpp index a0fe82396..f85805621 100644 --- a/src/gui/lua/luainstance.cpp +++ b/src/gui/lua/luainstance.cpp @@ -335,6 +335,12 @@ static void set_lua_variables(lua_State *L) { NULL, 0 } }; + table_key post_msg[] = + { + { "STANDBY_ON", (lua_Integer)CLuaInstMisc::POSTMSG_STANDBY_ON }, + { NULL, 0 } + }; + /* list of environment variable arrays to be exported */ lua_envexport e[] = { @@ -349,6 +355,7 @@ static void set_lua_variables(lua_State *L) { "DYNFONT", dynfont }, { "CURL", curl_status }, { "NMODE", neutrino_mode }, + { "POSTMSG", post_msg }, { NULL, NULL } }; diff --git a/src/gui/lua/luainstance.h b/src/gui/lua/luainstance.h index 96e52714e..9a8ec0ab9 100644 --- a/src/gui/lua/luainstance.h +++ b/src/gui/lua/luainstance.h @@ -31,7 +31,7 @@ extern "C" { #include "luainstance_helpers.h" #define LUA_API_VERSION_MAJOR 1 -#define LUA_API_VERSION_MINOR 32 +#define LUA_API_VERSION_MINOR 33 /* inspired by Steve Kemp http://www.steve.org.uk/ */ class CLuaInstance