diff --git a/apps/plugins/lua/rocklib.c b/apps/plugins/lua/rocklib.c index 4d7c5e8f04..4404598ad3 100644 --- a/apps/plugins/lua/rocklib.c +++ b/apps/plugins/lua/rocklib.c @@ -1052,6 +1052,11 @@ LUALIB_API int luaopen_rock(lua_State *L) { luaL_register(L, LUA_ROCKLIBNAME, rocklib); luaL_register(L, LUA_ROCKLIBNAME, rocklib_aux); +#ifdef SIMULATOR /* rb.SIMULATOR = true allows checking for the SIM in lua */ + lua_pushboolean(L, 1); + luaS_newlloc(L, "SIMULATOR", TSTR_INBIN); + lua_setfield(L, -2, "SIMULATOR"); +#endif lua_getglobal(L, "require"); lua_pushstring(L, "rb_defines"); if (lua_pcall (L, 1, 0, 0)) diff --git a/apps/plugins/lua_scripts/stars.lua b/apps/plugins/lua_scripts/stars.lua index e05007afb6..2a46b00707 100644 --- a/apps/plugins/lua_scripts/stars.lua +++ b/apps/plugins/lua_scripts/stars.lua @@ -414,7 +414,11 @@ action_event(rb.actions.ACTION_NONE) -- we can call this now but not after regis local eva = rockev.register("action", action_event) local evc = rockev.register("timer", action_drift, rb.HZ/7) +if not rb.SIMULATOR then while not action_quit() do rb.sleep(rb.HZ) end +else -- the SIM requires lcd_update to be called from the main thread +while not action_quit() do _lcd:update(); rb.sleep(10) end +end if start_x and start_y then file = io.open(fname, "w")