diff options
-rw-r--r-- | lib/BLua.cc | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/lib/BLua.cc b/lib/BLua.cc index 51a5e97..60cf4f2 100644 --- a/lib/BLua.cc +++ b/lib/BLua.cc @@ -17,7 +17,7 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -/* $Id: BLua.cc,v 1.22 2004-11-27 21:46:04 pixel Exp $ */ +/* $Id: BLua.cc,v 1.23 2004-12-13 20:07:09 pixel Exp $ */ #include "BLua.h" #include <lualib.h> @@ -353,7 +353,26 @@ int Lua::gettop() { } void Lua::error(const String & msg) { + String whole_msg; + struct lua_Debug ar; + bool got_error = false; + int level = 0; + + do { + if (lua_getstack(L, level, &ar) == 1) { + if (lua_getinfo(L, "nSl", &ar) != 0) { + push(String("at ") + ar.source + ":" + ar.currentline + " (" + (ar.name ? ar.name : "[top]") + ")"); + } else { + got_error = true; + } + } else { + got_error = true; + } + level++; + } while (!got_error); + push(msg); + lua_error(L); } |