mirror of
https://github.com/libretro/scummvm.git
synced 2025-02-11 21:55:27 +00:00
GRIM: Do not throw a lua_error when trying to call a unexisting function.
This is necessary for year 4' blue casket. Fixes #15
This commit is contained in:
parent
6cb4b2d267
commit
cf5c0e67ef
@ -229,8 +229,20 @@ int32 luaD_call(StkId base, int32 nResults) {
|
||||
firstResult = callC(fvalue(funcObj), base);
|
||||
} else {
|
||||
TObject *im = luaT_getimbyObj(funcObj, IM_FUNCTION);
|
||||
if (ttype(im) == LUA_T_NIL)
|
||||
lua_error("call expression not a function");
|
||||
if (ttype(im) == LUA_T_NIL) {
|
||||
// NOTE: Originally this throwed the lua_error. Anyway it is commented here because
|
||||
// when in year 4 bi.exit() calls bi.book.act:free(). But bi.book.act is nil,
|
||||
// hence it enters this branch and the error blocks the game.
|
||||
// Now we try instead to survive and go on with the function.
|
||||
lua_Task *t = lua_state->task;
|
||||
lua_state->task = t->next;
|
||||
lua_state->some_task = tmpTask;
|
||||
luaM_free(t);
|
||||
|
||||
warning("Lua: call expression not a function");
|
||||
return 1;
|
||||
// lua_error("call expression not a function");
|
||||
}
|
||||
luaD_callTM(im, (lua_state->stack.top - lua_state->stack.stack) - (base - 1), nResults);
|
||||
continue;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user