1
0
Fork 0
forked from len0rd/rockbox

lua add demo scripts, atexit handler, gui_scrollbar_draw

Change-Id: Ie8794e8a487f73952dae43e036787b6972fdbbee
This commit is contained in:
William Wilgus 2019-07-26 01:30:00 -05:00
parent 60c5a29408
commit 90118f14cf
22 changed files with 2374 additions and 22 deletions

View file

@ -771,6 +771,17 @@ RB_WRAP(audio_current_track)
return mem_read_write(L, address, maxsize);
}
RB_WRAP(restart_lua)
{
/*close lua state, open a new lua state, load script @ filename */
luaL_checktype (L, 1, LUA_TSTRING);
lua_settop(L, 1);
lua_pushlightuserdata(L, L); /* signal exit handler */
exit(1); /* atexit in rocklua.c */
return -1;
}
#define RB_FUNC(func) {#func, rock_##func}
#define RB_ALIAS(name, func) {name, rock_##func}
static const luaL_Reg rocklib[] =
@ -843,6 +854,8 @@ static const luaL_Reg rocklib[] =
RB_FUNC(audio_next_track),
RB_FUNC(audio_current_track),
RB_FUNC(restart_lua),
{NULL, NULL}
};
#undef RB_FUNC
@ -939,4 +952,3 @@ LUALIB_API int luaopen_rock(lua_State *L)
#endif
return 1;
}