forked from github/server
better handling of missing entry points
This commit is contained in:
parent
483615c458
commit
7618dc588d
|
@ -1286,7 +1286,7 @@ lua_State *lua_init(void) {
|
||||||
|
|
||||||
int eressea_run(lua_State *L, const char *luafile, const char *entry_point)
|
int eressea_run(lua_State *L, const char *luafile, const char *entry_point)
|
||||||
{
|
{
|
||||||
int err;
|
int err = 0;
|
||||||
|
|
||||||
global.vm_state = L;
|
global.vm_state = L;
|
||||||
/* run the main script */
|
/* run the main script */
|
||||||
|
@ -1303,14 +1303,16 @@ int eressea_run(lua_State *L, const char *luafile, const char *entry_point)
|
||||||
}
|
}
|
||||||
if (entry_point) {
|
if (entry_point) {
|
||||||
lua_getglobal(L, entry_point);
|
lua_getglobal(L, entry_point);
|
||||||
err = lua_pcall(L, 0, 1, 0);
|
if (lua_isfunction(L, -1)) {
|
||||||
if (err != 0) {
|
log_debug("calling entry-point: %s\n", entry_point);
|
||||||
log_lua_error(L);
|
err = lua_pcall(L, 0, 1, 0);
|
||||||
abort();
|
if (err != 0) {
|
||||||
|
log_lua_error(L);
|
||||||
|
}
|
||||||
return err;
|
return err;
|
||||||
|
} else {
|
||||||
|
log_error("unknown entry-point: %s\n", entry_point);
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
err = lua_console(L);
|
|
||||||
}
|
}
|
||||||
return err;
|
return lua_console(L);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue