crash with an assert if Lua code has syntax errors.

this addresses issue #474
also, correct capitalization of Lua.
This commit is contained in:
Enno Rehling 2016-02-09 21:34:24 +01:00
parent 91ca77bc48
commit 01e864273a
2 changed files with 3 additions and 2 deletions

View File

@ -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)) {

View File

@ -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;