don't leave classname lyingf around on stack
authorMatthias Braun <matze@braunis.de>
Sat, 2 Jul 2005 11:50:41 +0000 (11:50 +0000)
committerMatthias Braun <matze@braunis.de>
Sat, 2 Jul 2005 11:50:41 +0000 (11:50 +0000)
SVN-Revision: 2681

src/scripting/wrapper.cpp
tools/miniswig/create_wrapper.cpp

index f938c0b..50734e1 100644 (file)
@@ -38,6 +38,7 @@ void create_squirrel_instance(HSQUIRRELVM v, DisplayEffect* object, bool setup_r
     msg << "Couldn't setup squirrel instance for object of type 'DisplayEffect'";
     throw SquirrelError(v, msg.str());
   }
+  sq_remove(v, -2);
 
   if(setup_releasehook) {
     sq_setreleasehook(v, -1, DisplayEffect_release_hook);
@@ -111,6 +112,7 @@ void create_squirrel_instance(HSQUIRRELVM v, Camera* object, bool setup_releaseh
     msg << "Couldn't setup squirrel instance for object of type 'Camera'";
     throw SquirrelError(v, msg.str());
   }
+  sq_remove(v, -2);
 
   if(setup_releasehook) {
     sq_setreleasehook(v, -1, Camera_release_hook);
@@ -179,6 +181,7 @@ void create_squirrel_instance(HSQUIRRELVM v, Level* object, bool setup_releaseho
     msg << "Couldn't setup squirrel instance for object of type 'Level'";
     throw SquirrelError(v, msg.str());
   }
+  sq_remove(v, -2);
 
   if(setup_releasehook) {
     sq_setreleasehook(v, -1, Level_release_hook);
@@ -239,6 +242,7 @@ void create_squirrel_instance(HSQUIRRELVM v, ScriptedObject* object, bool setup_
     msg << "Couldn't setup squirrel instance for object of type 'ScriptedObject'";
     throw SquirrelError(v, msg.str());
   }
+  sq_remove(v, -2);
 
   if(setup_releasehook) {
     sq_setreleasehook(v, -1, ScriptedObject_release_hook);
@@ -408,6 +412,7 @@ void create_squirrel_instance(HSQUIRRELVM v, Sound* object, bool setup_releaseho
     msg << "Couldn't setup squirrel instance for object of type 'Sound'";
     throw SquirrelError(v, msg.str());
   }
+  sq_remove(v, -2);
 
   if(setup_releasehook) {
     sq_setreleasehook(v, -1, Sound_release_hook);
@@ -458,6 +463,7 @@ void create_squirrel_instance(HSQUIRRELVM v, Text* object, bool setup_releasehoo
     msg << "Couldn't setup squirrel instance for object of type 'Text'";
     throw SquirrelError(v, msg.str());
   }
+  sq_remove(v, -2);
 
   if(setup_releasehook) {
     sq_setreleasehook(v, -1, Text_release_hook);
@@ -544,6 +550,7 @@ void create_squirrel_instance(HSQUIRRELVM v, Player* object, bool setup_releaseh
     msg << "Couldn't setup squirrel instance for object of type 'Player'";
     throw SquirrelError(v, msg.str());
   }
+  sq_remove(v, -2);
 
   if(setup_releasehook) {
     sq_setreleasehook(v, -1, Player_release_hook);
index 5186f66..ed50a15 100644 (file)
@@ -444,6 +444,7 @@ WrapperCreator::create_squirrel_instance(Class* _class)
         << "object of type '" << _class->name << "'\";\n"
         << ind << ind << "throw SquirrelError(v, msg.str());\n"
         << ind << "}\n"
+        << ind << "sq_remove(v, -2);\n"
         << "\n"
         << ind << "if(setup_releasehook) {\n"
         << ind << ind << "sq_setreleasehook(v, -1, "