From 6f122fd544e0c77cc6c38a294a353d7bd4accf9d Mon Sep 17 00:00:00 2001 From: Thorbjørn Lindeijer Date: Sun, 22 Aug 2010 02:40:52 +0200 Subject: Print out the actual error message in case of a syntax error Should help to locate the problem. Reviewed-by: Jared Adams --- src/scripting/luascript.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'src/scripting/luascript.cpp') diff --git a/src/scripting/luascript.cpp b/src/scripting/luascript.cpp index 33145b56..8e19cd52 100644 --- a/src/scripting/luascript.cpp +++ b/src/scripting/luascript.cpp @@ -86,9 +86,13 @@ void LuaScript::load(const char *prog) { int res = luaL_loadstring(mState, prog); - if (res == LUA_ERRSYNTAX) - { - LOG_ERROR("Syntax error while loading Lua script."); + switch (res) { + case LUA_ERRSYNTAX: + LOG_ERROR("Syntax error while loading Lua script: " + << lua_tostring(mState, -1)); + return; + case LUA_ERRMEM: + LOG_ERROR("Memory allocation error while loading Lua script"); return; } -- cgit v1.2.3-70-g09d2