summaryrefslogtreecommitdiff
path: root/lib/BLua.cc
diff options
context:
space:
mode:
Diffstat (limited to 'lib/BLua.cc')
-rw-r--r--lib/BLua.cc19
1 files changed, 12 insertions, 7 deletions
diff --git a/lib/BLua.cc b/lib/BLua.cc
index 9e5373e..c3f7351 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.8 2003-12-07 04:44:38 pixel Exp $ */
+/* $Id: BLua.cc,v 1.9 2003-12-07 05:50:41 pixel Exp $ */
#include <lualib.h>
@@ -33,7 +33,8 @@ class LuaStatics : public Base {
public:
static const char * getF(lua_State *, void *, size_t *);
static int putF(lua_State *, const void *, size_t, void *);
- static int luapanic(lua_State *) throw(GeneralException);
+ static int luapanic(lua_State *);
+ static int trueluapanic(lua_State *) throw(GeneralException);
static int destructor(lua_State *);
static int andB(lua_State *);
@@ -45,7 +46,11 @@ class LuaStatics : public Base {
std::map<lua_State *, Lua *> Lua::lualist;
-int LuaStatics::luapanic(lua_State * L) throw (GeneralException) {
+int LuaStatics::luapanic(lua_State * L) {
+ return trueluapanic(L);
+}
+
+int LuaStatics::trueluapanic(lua_State * L) throw (GeneralException) {
Lua::find(L)->showerror();
throw LuaException("Error running Lua code, bailing out.");
}
@@ -437,10 +442,10 @@ void Lua::showerror() {
t.set("(Number) %f", lua_tonumber(L, i));
break;
case LUA_TBOOLEAN:
- t.set("(Bool) %s", lua_toboolean(L, i) ? "true" : "false");
+ t = String("(Bool) ") + (lua_toboolean(L, i) ? "true" : "false");
break;
case LUA_TSTRING:
- t.set("(String) %s", lua_tostring(L, i));
+ t = String("(String) ") + lua_tostring(L, i);
break;
case LUA_TTABLE:
t = "(Table)";
@@ -499,13 +504,13 @@ void LuaObject::pushit(Lua * L, const String & s, lua_CFunction f) {
}
void LuaObject::pushmeta(Lua * L, const String & s, lua_CFunction f) {
- if (!L->getmetatable(1)) {
+ if (!L->getmetatable()) {
L->newtable();
}
L->push(s);
L->push(f);
L->settable();
- L->setmetatable(1);
+ L->setmetatable();
}
int LuaStatics::destructor(lua_State * _L) {