- sq_remove(v, -2); // remove roottable
-
- // create an instance and set pointer to c++ object
- if(sq_createinstance(v, -1) < 0 || sq_setinstanceup(v, -1, object)) {
- std::ostringstream msg;
- msg << "Couldn't setup squirrel instance for object '"
- << name << "' of type '" << type << "'.";
- throw SquirrelError(v, msg.str());
- }
-
- sq_remove(v, -2); // remove class from stack
-
- // part2 of registration of the instance in the root table
- if(sq_createslot(v, -3) < 0)
- throw SquirrelError(v, "Couldn't register object in squirrel root table"); sq_pop(v, 1);