diff --git a/src/bindings/bindings.c b/src/bindings/bindings.c index ea86df4a0..f4832a727 100755 --- a/src/bindings/bindings.c +++ b/src/bindings/bindings.c @@ -1286,7 +1286,7 @@ lua_State *lua_init(void) { int eressea_run(lua_State *L, const char *luafile, const char *entry_point) { - int err; + int err = 0; global.vm_state = L; /* run the main script */ @@ -1303,14 +1303,16 @@ int eressea_run(lua_State *L, const char *luafile, const char *entry_point) } if (entry_point) { lua_getglobal(L, entry_point); - err = lua_pcall(L, 0, 1, 0); - if (err != 0) { - log_lua_error(L); - abort(); + if (lua_isfunction(L, -1)) { + log_debug("calling entry-point: %s\n", entry_point); + err = lua_pcall(L, 0, 1, 0); + if (err != 0) { + log_lua_error(L); + } return err; + } else { + log_error("unknown entry-point: %s\n", entry_point); } - } else { - err = lua_console(L); } - return err; -} + return lua_console(L); +}