int Instance::lua_IsAncestorOf(lua_State* L){
		Instance* inst = checkInstance(L, 1);
		if(inst){
			bool throwErrorIf = true;
			Instance* otherInst = NULL;
			if(lua_isnil(L, 2)){
				throwErrorIf = false;
			}else{
				otherInst = checkInstance(L, 2);
			}
			if(otherInst != NULL || !throwErrorIf){
				bool isIt = inst->IsAncestorOf(otherInst);
				lua_pushboolean(L, isIt);
				return 1;
			}else{
				return luaL_typerror(L, 2, "Instance");
			}
			return 0;
		}
		return luaL_error(L, COLONERR, "IsAncestorOf");
	}
	bool Instance::IsAncestorOf(Instance* descendant){
		if(descendant == NULL){
			return true;
		}
		for(std::vector<Instance*>::size_type i = 0; i != children.size(); i++){
			Instance* kid = children[i];
			if(kid != NULL){
				if(kid == descendant){
					return true;
				}
			}
		}
		for(std::vector<Instance*>::size_type i = 0; i != children.size(); i++){
			Instance* kid = children[i];
			if(kid != NULL){
				bool isAncestor = kid->IsAncestorOf(descendant);
				if(isAncestor){
					return true;
				}
			}
		}
		return false;
	}