From 01e864273ab36d6c79f8c5b8f17d50e624627bc6 Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Tue, 9 Feb 2016 21:34:24 +0100 Subject: [PATCH] crash with an assert if Lua code has syntax errors. this addresses issue #474 also, correct capitalization of Lua. --- src/bindings.c | 3 ++- src/modules/museum.c | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/bindings.c b/src/bindings.c index 99458c08d..72f14103d 100755 --- a/src/bindings.c +++ b/src/bindings.c @@ -96,7 +96,7 @@ TOLUA_PKG(game); int log_lua_error(lua_State * L) { 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); return 1; } @@ -1183,6 +1183,7 @@ int eressea_run(lua_State *L, const char *luafile) err = lua_pcall(L, 1, 1, -3); if (err != 0) { log_lua_error(L); + assert(!"Lua syntax error? check log."); } else { if (lua_isnumber(L, -1)) { diff --git a/src/modules/museum.c b/src/modules/museum.c index e1e7d33e5..516bf775f 100644 --- a/src/modules/museum.c +++ b/src/modules/museum.c @@ -194,7 +194,7 @@ void warden_add_give(unit * src, unit * u, const item_type * itype, int n) 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"); plane *museum = getplanebyid(museum_id); region *r;