1
0
Fork 0
mirror of https://github.com/opentx/opentx.git synced 2025-07-26 01:35:21 +03:00

Add a function to raise an error from a Lua script

This commit is contained in:
bsongis 2014-05-27 21:55:47 +02:00
parent 415f1d3dca
commit 14dec6f432

View file

@ -200,6 +200,13 @@ static int luaKillEvents(lua_State *L)
return 0;
}
static int luaRaise(lua_State *L)
{
const char * message = luaL_checkstring(L, 1);
throw message;
return 0;
}
static int luaLcdLock(lua_State *L)
{
lcd_locked = true;
@ -1036,6 +1043,7 @@ void luaInit()
lua_register(L, "popupInput", luaPopupInput);
lua_register(L, "channelOrder", luaChannelOrder);
lua_register(L, "killEvents", luaKillEvents);
lua_register(L, "raise", luaRaise);
// Push OpenTX constants
lua_registerint(L, "FULLSCALE", RESX);