From 35294ec19264e0b90ff4cb98aedf7ed438aa3333 Mon Sep 17 00:00:00 2001 From: pixel Date: Tue, 22 May 2007 08:46:59 +0000 Subject: Adding showstack() method. --- lib/BLua.cc | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'lib') diff --git a/lib/BLua.cc b/lib/BLua.cc index 3f7df94..799d54e 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.40 2007-04-11 00:16:30 pixel Exp $ */ +/* $Id: BLua.cc,v 1.41 2007-05-22 08:46:59 pixel Exp $ */ #include #include "BLua.h" @@ -1035,15 +1035,13 @@ Lua * Lua::find(lua_State * __L) throw (GeneralException) { return i->second; } -void Lua::showerror() { +void Lua::showstack(int level) { int n = lua_gettop(L); int i; String t; - printm(M_ERROR, "Lua object: Got an LUA error, inspecting stack.\n"); - if (n == 0) { - printm(M_ERROR, "Stack empty\n"); + printm(level, "Stack empty\n"); return; } @@ -1074,10 +1072,16 @@ void Lua::showerror() { t = "Unknown"; } - printm(M_ERROR, String(i) + ": " + t + "\n"); + printm(level, String(i) + ": " + t + "\n"); } } +void Lua::showerror() { + printm(M_ERROR, "Lua object: Got an LUA error, inspecting stack.\n"); + + showstack(M_ERROR); +} + int Lua::getmetatable(int i) { return lua_getmetatable(L, i); } -- cgit v1.2.3