summaryrefslogtreecommitdiff
path: root/src/scripting
diff options
context:
space:
mode:
authorThorbjørn Lindeijer <thorbjorn@lindeijer.nl>2010-08-22 02:40:52 +0200
committerThorbjørn Lindeijer <thorbjorn@lindeijer.nl>2010-08-22 13:11:31 +0200
commit6f122fd544e0c77cc6c38a294a353d7bd4accf9d (patch)
tree7dd2c54a08bd42afc30c5aae938670cec758a3e3 /src/scripting
parent503927e5826569061af0a986664bf1083f42bcb0 (diff)
downloadmanaserv-6f122fd544e0c77cc6c38a294a353d7bd4accf9d.tar.gz
manaserv-6f122fd544e0c77cc6c38a294a353d7bd4accf9d.tar.bz2
manaserv-6f122fd544e0c77cc6c38a294a353d7bd4accf9d.tar.xz
manaserv-6f122fd544e0c77cc6c38a294a353d7bd4accf9d.zip
Print out the actual error message in case of a syntax error
Should help to locate the problem. Reviewed-by: Jared Adams
Diffstat (limited to 'src/scripting')
-rw-r--r--src/scripting/luascript.cpp10
1 files changed, 7 insertions, 3 deletions
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;
}