From c58541468c5477323e35837a8f0aeaf41e5a0794 Mon Sep 17 00:00:00 2001 From: deva Date: Fri, 13 Aug 2010 11:56:34 +0000 Subject: Fix one too many resets of the LUA stack. --- client/lua.cc | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) (limited to 'client/lua.cc') diff --git a/client/lua.cc b/client/lua.cc index 3dd5381..062e520 100644 --- a/client/lua.cc +++ b/client/lua.cc @@ -32,6 +32,9 @@ #include "luawidget.h" +#define DEBUG(fmt...) printf("LUA (%p)", this); printf(fmt); fflush(stdout) +//#define DEBUG(ftm...) + #define GLOBAL_POINTER "_pracroGlobalLUAObjectPointerThisShouldBeANameThatIsNotAccidentallyOverwritten" static int get_widget(lua_State *L) @@ -58,7 +61,7 @@ static int get_widget(lua_State *L) Widget *widget = lua->getWidget(name); - // printf("FIND: %s (%p)\n", name.toStdString().c_str(), widget); + // DEBUG("FIND: %s (%p)\n", name.toStdString().c_str(), widget); if(widget) { wdg_make_widget(L, widget); @@ -66,7 +69,7 @@ static int get_widget(lua_State *L) lua_pushnil(L); } - // printf("DONE\n"); + // DEBUG("DONE\n"); return 1; } @@ -111,7 +114,7 @@ QString LUA::runParser(QString program) return false; } - printf("Running %s\n", program.toStdString().c_str()); + DEBUG("Running %s\n", program.toStdString().c_str()); int top = lua_gettop(L); @@ -152,10 +155,10 @@ bool LUA::runScript(QString script, Widget *widget, QString name) return false; } - printf("Running %s script %s on %s widget.\n", - name.toStdString().c_str(), - script.toStdString().c_str(), - widget?widget->name().toStdString().c_str():"NULL"); + DEBUG("Running %s script %s on %s widget.\n", + name.toStdString().c_str(), + script.toStdString().c_str(), + widget?widget->name().toStdString().c_str():"NULL"); if(widget) { wdg_make_widget(L, widget); @@ -181,7 +184,7 @@ bool LUA::runScript(QString script, Widget *widget, QString name) void LUA::error(QString message) { - printf("LUA ERROR: %s\n", message.toStdString().c_str()); + DEBUG("LUA ERROR: %s\n", message.toStdString().c_str()); } Widget *LUA::getWidget(QString name) -- cgit v1.2.3