CLuaInstMisc:: Add script function postMsg() to send a neutrino message

- Currently possible message: POSTMSG.STANDBY_ON
 - Set Lua api version to 1.33
This commit is contained in:
M. Liebmann
2015-12-15 21:48:19 +01:00
parent 3a64f6c230
commit 37e8c328c5
4 changed files with 30 additions and 1 deletions

View File

@@ -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);