forked from github/server
crash with an assert if Lua code has syntax errors.
this addresses issue #474 also, correct capitalization of Lua.
This commit is contained in:
parent
91ca77bc48
commit
01e864273a
2 changed files with 3 additions and 2 deletions
|
@ -96,7 +96,7 @@ TOLUA_PKG(game);
|
||||||
int log_lua_error(lua_State * L)
|
int log_lua_error(lua_State * L)
|
||||||
{
|
{
|
||||||
const char *error = lua_tostring(L, -1);
|
const char *error = lua_tostring(L, -1);
|
||||||
log_fatal("LUA call failed.\n%s\n", error);
|
log_fatal("Lua call failed.\n%s\n", error);
|
||||||
lua_pop(L, 1);
|
lua_pop(L, 1);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
@ -1183,6 +1183,7 @@ int eressea_run(lua_State *L, const char *luafile)
|
||||||
err = lua_pcall(L, 1, 1, -3);
|
err = lua_pcall(L, 1, 1, -3);
|
||||||
if (err != 0) {
|
if (err != 0) {
|
||||||
log_lua_error(L);
|
log_lua_error(L);
|
||||||
|
assert(!"Lua syntax error? check log.");
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (lua_isnumber(L, -1)) {
|
if (lua_isnumber(L, -1)) {
|
||||||
|
|
|
@ -194,7 +194,7 @@ void warden_add_give(unit * src, unit * u, const item_type * itype, int n)
|
||||||
|
|
||||||
void create_museum(void)
|
void create_museum(void)
|
||||||
{
|
{
|
||||||
#if 0 /* TODO: move this to LUA. It should be possible. */
|
#if 0 /* TODO: move this to Lua. It should be possible. */
|
||||||
unsigned int museum_id = hashstring("museum");
|
unsigned int museum_id = hashstring("museum");
|
||||||
plane *museum = getplanebyid(museum_id);
|
plane *museum = getplanebyid(museum_id);
|
||||||
region *r;
|
region *r;
|
||||||
|
|
Loading…
Reference in a new issue