#593 fixed crash
This commit is contained in:
parent
26551ca5ec
commit
60c43863c6
|
@ -2239,7 +2239,17 @@ static void onConsoleEvalCommand(Console* console, const char* param)
|
|||
printLine(console);
|
||||
|
||||
const tic_script_config* script_config = console->tic->api.get_script_config(console->tic);
|
||||
|
||||
if (script_config->eval)
|
||||
{
|
||||
if(param)
|
||||
script_config->eval(console->tic, param);
|
||||
else printError(console, "nothing to eval");
|
||||
}
|
||||
else
|
||||
{
|
||||
printError(console, "'eval' not implemented for the script");
|
||||
}
|
||||
|
||||
commandDone(console);
|
||||
}
|
||||
|
|
12
src/luaapi.c
12
src/luaapi.c
|
@ -1414,10 +1414,12 @@ static const tic_outline_item* getLuaOutline(const char* code, s32* size)
|
|||
return items;
|
||||
}
|
||||
|
||||
void evalLua(tic_mem* tic, const char* code) {
|
||||
static void evalLua(tic_mem* tic, const char* code) {
|
||||
tic_machine* machine = (tic_machine*)tic;
|
||||
lua_State* lua = machine->lua;
|
||||
|
||||
if (!lua) return;
|
||||
|
||||
lua_settop(lua, 0);
|
||||
|
||||
if(luaL_loadstring(lua, code) != LUA_OK || lua_pcall(lua, 0, LUA_MULTRET, 0) != LUA_OK)
|
||||
|
@ -1426,10 +1428,6 @@ void evalLua(tic_mem* tic, const char* code) {
|
|||
}
|
||||
}
|
||||
|
||||
void evalPlaceholder(tic_mem* tic, const char* code) {
|
||||
printf("TODO: not yet implemented\n.");
|
||||
}
|
||||
|
||||
static const tic_script_config LuaSyntaxConfig =
|
||||
{
|
||||
.init = initLua,
|
||||
|
@ -1609,7 +1607,7 @@ static const tic_script_config MoonSyntaxConfig =
|
|||
|
||||
.getOutline = getMoonOutline,
|
||||
.parse = parseCode,
|
||||
.eval = evalPlaceholder,
|
||||
.eval = NULL,
|
||||
|
||||
.blockCommentStart = NULL,
|
||||
.blockCommentEnd = NULL,
|
||||
|
@ -1750,7 +1748,7 @@ static const tic_outline_item* getFennelOutline(const char* code, s32* size)
|
|||
return items;
|
||||
}
|
||||
|
||||
void evalFennel(tic_mem* tic, const char* code) {
|
||||
static void evalFennel(tic_mem* tic, const char* code) {
|
||||
tic_machine* machine = (tic_machine*)tic;
|
||||
lua_State* fennel = machine->lua;
|
||||
|
||||
|
|
|
@ -1372,7 +1372,7 @@ static const tic_outline_item* getWrenOutline(const char* code, s32* size)
|
|||
return items;
|
||||
}
|
||||
|
||||
void evalWren(tic_mem* memory, const char* code)
|
||||
static void evalWren(tic_mem* memory, const char* code)
|
||||
{
|
||||
tic_machine* machine = (tic_machine*)memory;
|
||||
wrenInterpret(machine->wren, code);
|
||||
|
|
Loading…
Reference in New Issue