diff --git a/src/api/fennel.c b/src/api/fennel.c index 433c18f89..44cc3a4f4 100644 --- a/src/api/fennel.c +++ b/src/api/fennel.c @@ -165,6 +165,10 @@ static void evalFennel(tic_mem* tic, const char* code) { tic_core* core = (tic_core*)tic; lua_State* fennel = core->currentVM; + /* if we proceed with an uninitialized VM it will segfault; however */ + /* it could be better just to initialize here when needed instead! */ + if (!fennel) return; + lua_settop(fennel, 0); if (luaL_loadbuffer(fennel, execute_fennel_src, strlen(execute_fennel_src), "execute_fennel") != LUA_OK) diff --git a/src/studio/screens/console.c b/src/studio/screens/console.c index 09efb37be..53f8ad04c 100644 --- a/src/studio/screens/console.c +++ b/src/studio/screens/console.c @@ -2667,6 +2667,23 @@ static void onRunCommand(Console* console) static void onResumeCommand(Console* console) { + if(console->desc->count) + { + const char* param = console->desc->params->key; + + if(strcmp(param, "reload") == 0) + { + const tic_script* script_config = tic_get_script(console->tic); + if (script_config->eval) + { + script_config->eval(console->tic, console->tic->cart.code.data); + } + else + { + printError(console, "eval not implemented for the script"); + } + } + } commandDone(console); resumeGame(console->studio);