Exemplo n.º 1
0
	int Instance::lua_Clone(lua_State* L){
		Instance* inst = checkInstance(L, 1);
		if(inst){
			Instance* newGuy = inst->Clone();
			if(newGuy != NULL){
				return newGuy->wrap_lua(L);
			}
			return 0;
		}
		return luaL_error(L, COLONERR, "Clone");
	}
Exemplo n.º 2
0
	Instance* Instance::Clone(){
		if(Archivable){
			Instance* newGuy = cloneImpl();
			if(newGuy == NULL){
				return NULL;
			}
			for(std::vector<Instance*>::size_type i = 0; i != children.size(); i++){
				Instance* kid = children[i];
				if(kid != NULL){
					Instance* kidClone = kid->Clone();
					if(kidClone != NULL){
						kidClone->setParent(newGuy);
					}
				}
			}
		}
		return NULL;
	}