summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpixel <pixel>2007-05-22 08:46:59 +0000
committerpixel <pixel>2007-05-22 08:46:59 +0000
commit35294ec19264e0b90ff4cb98aedf7ed438aa3333 (patch)
tree8ef31f7c6f6ed58f89b8cc9fffd6410e925fa6cc
parent6938bdc415e924b7ef404e4ed1781ae782bfa0c0 (diff)
Adding showstack() method.
-rw-r--r--include/BLua.h3
-rw-r--r--lib/BLua.cc16
2 files changed, 12 insertions, 7 deletions
diff --git a/include/BLua.h b/include/BLua.h
index b579333..a39ddbc 100644
--- a/include/BLua.h
+++ b/include/BLua.h
@@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-/* $Id: BLua.h,v 1.31 2007-04-11 00:16:30 pixel Exp $ */
+/* $Id: BLua.h,v 1.32 2007-05-22 08:46:59 pixel Exp $ */
#ifndef __BLUA_H__
#define __BLUA_H__
@@ -108,6 +108,7 @@ class Lua : public Base {
void resume(const String &, int nargs = 0);
void resume(Handle *, int nargs = 0);
static Lua * find(lua_State *) throw (GeneralException);
+ void showstack(int level = M_INFO);
void showerror();
int getmetatable(int = -1);
int setmetatable(int = -2);
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 <stdlib.h>
#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);
}