bool ValueAnimation::SetKeyFrame(float time, const Variant& value)
{
    if (valueType_ == VAR_NONE)
        SetValueType(value.GetType());
    else if (value.GetType() != valueType_)
        return false;

    VAnimKeyFrame keyFrame;
    keyFrame.time_ = time;
    keyFrame.value_ = value;

    if (keyFrames_.Empty() || time > keyFrames_.Back().time_)
        keyFrames_.Push(keyFrame);
    else
    {
        for (unsigned i = 0; i < keyFrames_.Size(); ++i)
        {
            // Guard against interpolation error caused by division by error due to 0 delta time between two key frames
            if (time == keyFrames_[i].time_)
                return false;
            if (time < keyFrames_[i].time_)
            {
                keyFrames_.Insert(i, keyFrame);
                break;
            }
        }
    }

    beginTime_ = Min(time, beginTime_);
    endTime_ = Max(time, endTime_);
    splineTangentsDirty_ = true;

    return true;
}
Example #2
0
void JSONValue::SetVectorVariant(const String& name, const Variant& value)
{
    VariantType type = value.GetType();
    if (type == VAR_FLOAT || type == VAR_VECTOR2 || type == VAR_VECTOR3 || type == VAR_VECTOR4 || type == VAR_MATRIX3 ||
        type == VAR_MATRIX3X4 || type == VAR_MATRIX4)
        SetString(name, value.ToString());
}
Example #3
0
void Material::SetShaderParameter(const String& name, const Variant& value)
{
    MaterialShaderParameter newParam;
    newParam.name_ = name;
    newParam.value_ = value;
    StringHash nameHash(name);
    shaderParameters_[nameHash] = newParam;

    if (nameHash == PSP_MATSPECCOLOR)
    {
        VariantType type = value.GetType();
        if (type == VAR_VECTOR3)
        {
            const Vector3& vec = value.GetVector3();
            specular_ = vec.x_ > 0.0f || vec.y_ > 0.0f || vec.z_ > 0.0f;
        }
        else if (type == VAR_VECTOR4)
        {
            const Vector4& vec = value.GetVector4();
            specular_ = vec.x_ > 0.0f || vec.y_ > 0.0f || vec.z_ > 0.0f;
        }
    }

    if (!batchedParameterUpdate_)
    {
        RefreshShaderParameterHash();
        RefreshMemoryUse();
    }
}
Example #4
0
void JSONValue::AddVectorVariant(const Variant& value)
{
    VariantType type = value.GetType();
    if (type == VAR_FLOAT || type == VAR_VECTOR2 || type == VAR_VECTOR3 || type == VAR_VECTOR4 || type == VAR_MATRIX3 ||
        type == VAR_MATRIX3X4 || type == VAR_MATRIX4)
        AddString(value.ToString());
}
Example #5
0
Owned<void> DynamicMove(Variant value)
{
	if (!value.GetType().is_move_constructible())
	{
		return nullptr;
	}

	// Create constructor
	auto constructor = [&](byte* location)
	{
		value.GetType().get_move_constructor()(location, value.GetValue());
	};

	// Construct object
	return AllocateDynamicNew(value.GetType(), constructor);
}
Example #6
0
bool XMLElement::SetVectorVariant(const String& name, const Variant& value)
{
    VariantType type = value.GetType();
    if (type == VAR_FLOAT || type == VAR_VECTOR2 || type == VAR_VECTOR3 || type == VAR_VECTOR4)
        return SetAttribute(name, value.ToString());
    else
        return false;
}
Example #7
0
void Graphics::SetShaderParameter(StringHash param, const Variant& value)
{
    switch (value.GetType())
    {
    case VAR_BOOL:
        SetShaderParameter(param, value.GetBool());
        break;

    case VAR_INT:
        SetShaderParameter(param, value.GetInt());
        break;

    case VAR_FLOAT:
    case VAR_DOUBLE:
        SetShaderParameter(param, value.GetFloat());
        break;

    case VAR_VECTOR2:
        SetShaderParameter(param, value.GetVector2());
        break;

    case VAR_VECTOR3:
        SetShaderParameter(param, value.GetVector3());
        break;

    case VAR_VECTOR4:
        SetShaderParameter(param, value.GetVector4());
        break;

    case VAR_COLOR:
        SetShaderParameter(param, value.GetColor());
        break;

    case VAR_MATRIX3:
        SetShaderParameter(param, value.GetMatrix3());
        break;

    case VAR_MATRIX3X4:
        SetShaderParameter(param, value.GetMatrix3x4());
        break;

    case VAR_MATRIX4:
        SetShaderParameter(param, value.GetMatrix4());
        break;

    case VAR_BUFFER:
        {
            const PODVector<unsigned char>& buffer = value.GetBuffer();
            if (buffer.Size() >= sizeof(float))
                SetShaderParameter(param, reinterpret_cast<const float*>(&buffer[0]), buffer.Size() / sizeof(float));
        }
        break;

    default:
        // Unsupported parameter type, do nothing
        break;
    }
}
Example #8
0
void DataPackage::SerializeVariant(ByteArrayWriter& writer, const Variant& variant) {
    Variant::Type type = variant.GetType();
    int8_t typeCode = Variant::TypeCodes[type];
    std::map<int8_t, std::shared_ptr<Writable>>& writables = GetWritables();
    std::shared_ptr<Writable> writable = writables[typeCode];

    writer.Write<int8_t>(typeCode);
    writable->Write(writer, variant);
}
Example #9
0
void Spline::AddKnot(const Variant& knot) 
{ 
    if (knots_.Size() > 0 && knots_[0].GetType() == knot.GetType())
        knots_.Push(knot);
    else if (knots_.Empty())
        knots_.Push(knot);
    else
        LOGERRORF("Attempted to add Knot to Spline of type %s where elements are already using %s", knot.GetTypeName().CString(), knots_[0].GetTypeName().CString());
}
Example #10
0
bool Serializer::WriteVariant(const Variant& value)
{
    bool success = true;
    VariantType type = value.GetType();

    success &= WriteUByte((unsigned char)type);
    success &= WriteVariantData(value);
    return success;
}
Example #11
0
void Spline::SetKnot(const Variant& knot, unsigned index)
{
    if (index >= 0 && index < knots_.Size())
    {
        if (knots_.Size() > 0 && knots_[0].GetType() == knot.GetType())
            knots_[index] = knot;
        else if (knots_.Empty())
            knots_.Push(knot);
        else
            LOGERRORF("Attempted to set a Spline's Knot value of type %s where elements are already using %s", knot.GetTypeName().CString(), knots_[0].GetTypeName().CString());
    }
}
Example #12
0
Variant Variant::operator+(Variant value)
{
    Variant ret;
    if (value.GetType() == VARTYPE_STRING || this->GetType() == VARTYPE_STRING) {
        string s;
        s += (const char *) *this;
        s += (const char *) value;
        ret = s;
    } else
        ret = ((int) *this + (int) value);
    return ret;
}
Example #13
0
bool Variant::operator==(Variant value)
{
    if (value.GetType() == VARTYPE_UNINITIALISED) {
        return (internaltype == VARTYPE_UNINITIALISED);
    }
    switch (internaltype) {
    case VARTYPE_OBJREF:{
            int intval = value;
            if (value.GetType() == VARTYPE_OBJREF)
                return intvalue == intval;
            else
                return false;
        }
    case VARTYPE_STRING:{
            string strval = value;
            return (stringvalue == strval);
        }
    case VARTYPE_BOOL:{
            bool boolval = value;
            return (intvalue == boolval);
        }
    case VARTYPE_INT:{
            int intval = value;
            return (intvalue == intval);
        }
    case VARTYPE_ULONG:{
            unsigned long uval = value;
            return (ulongvalue == uval);
        }
    case VARTYPE_DOUBLE:{
            double dblval = value;
            return (dblvalue == dblval);
        }
    case VARTYPE_UNINITIALISED:
        return (value.GetType() == VARTYPE_UNINITIALISED);
    default:
        return false;
    }
}
Example #14
0
void Spline::AddKnot(const Variant& knot, unsigned index)
{
    if (index > knots_.Size())
        index = knots_.Size();

    if (knots_.Size() > 0 && knots_[0].GetType() == knot.GetType())
        knots_.Insert(index, knot);
    else if (knots_.Empty())
        knots_.Push(knot);
    else
        URHO3D_LOGERRORF("Attempted to add Knot to Spline of type %s where elements are already using %s", knot.GetTypeName().CString(),
            knots_[0].GetTypeName().CString());
}
Example #15
0
int EventGetAttrparameters(lua_State* L)
{
    Event* evt = LuaType<Event>::check(L,1);
    LUACHECKOBJ(evt);
    const Dictionary* params = evt->GetParameters();
    int index = 0;
    String key;
    Variant* value;

    lua_newtable(L);
    int tableindex = lua_gettop(L);
    while(params->Iterate(index,key,value))
    {
        lua_pushstring(L,key.CString());
        Variant::Type type = value->GetType();
        switch(type)
        {
        case Variant::BYTE:
        case Variant::CHAR:
        case Variant::INT:
            lua_pushinteger(L,value->Get<int>());
            break;
        case Variant::FLOAT:
            lua_pushnumber(L,value->Get<float>());
            break;
        case Variant::COLOURB:
            LuaType<Colourb>::push(L,&value->Get<Colourb>(),false);
            break;
        case Variant::COLOURF:
            LuaType<Colourf>::push(L,&value->Get<Colourf>(),false);
            break;
        case Variant::STRING:
            lua_pushstring(L,value->Get<String>().CString());
            break;
        case Variant::VECTOR2:
            //according to Variant.inl, it is going to be a Vector2f
            LuaType<Vector2f>::push(L,&value->Get<Vector2f>(),false);
            break;
        case Variant::VOIDPTR:
            lua_pushlightuserdata(L,value->Get<void*>());
            break;
        default:
            lua_pushnil(L);
            break;
        }
        lua_settable(L,tableindex);
    }
    return 1;
}
void PushVariant(duk_context* ctx, const Variant& variant)
{
    switch (variant.GetType())
    {
    case Urho3D::VAR_BOOL:
        duk_push_boolean(ctx, variant.GetBool() ? 1 : 0);
        break;
    
    case Urho3D::VAR_INT:
        duk_push_number(ctx, (duk_double_t)variant.GetInt());
        break;
    
    case Urho3D::VAR_FLOAT:
        duk_push_number(ctx, variant.GetFloat());
        break;
    
    case Urho3D::VAR_DOUBLE:
        duk_push_number(ctx, variant.GetFloat());
        break;
    
    case Urho3D::VAR_STRING:
        duk_push_string(ctx, variant.GetString().CString());
        break;
    
    case Urho3D::VAR_VECTOR2:
        PushValueObjectCopy<float2>(ctx, float2(variant.GetVector2()), float2_ID, float2_Finalizer);
        break;
    
    case Urho3D::VAR_VECTOR3:
        PushValueObjectCopy<float3>(ctx, float3(variant.GetVector3()), float3_ID, float3_Finalizer);
        break;
    
    case Urho3D::VAR_VECTOR4:
        PushValueObjectCopy<float4>(ctx, float4(variant.GetVector4()), float4_ID, float4_Finalizer);
        break;
    
    case Urho3D::VAR_QUATERNION:
        PushValueObjectCopy<Quat>(ctx, Quat(variant.GetQuaternion()), Quat_ID, Quat_Finalizer);
        break;
    
    default:
        /// \todo More types
        duk_push_null(ctx);
        break;
    }
}
Example #17
0
Variant Spline::LinearInterpolation(const Variant& lhs, const Variant& rhs, float t) const
{
    switch (lhs.GetType())
    {
    case VAR_FLOAT:
        return Lerp(lhs.GetFloat(), rhs.GetFloat(), t);
    case VAR_VECTOR2:
        return lhs.GetVector2().Lerp(rhs.GetVector2(), t);
    case VAR_VECTOR3:
        return lhs.GetVector3().Lerp(rhs.GetVector3(), t);
    case VAR_VECTOR4:
        return lhs.GetVector4().Lerp(rhs.GetVector4(), t);
    case VAR_COLOR:
        return lhs.GetColor().Lerp(rhs.GetColor(), t);
    default:
        return Variant::EMPTY;
    }
}
Example #18
0
bool XMLElement::SetVariantValue(const Variant& value)
{
    switch (value.GetType())
    {
    case VAR_RESOURCEREF:
        return SetResourceRef(value.GetResourceRef());

    case VAR_RESOURCEREFLIST:
        return SetResourceRefList(value.GetResourceRefList());

    case VAR_VARIANTVECTOR:
        return SetVariantVector(value.GetVariantVector());

    case VAR_VARIANTMAP:
        return SetVariantMap(value.GetVariantMap());

    default:
        return SetAttribute("value", value.ToString().CString());
    }
}
Example #19
0
void JSONValue::AddVariantValue(const Variant& value)
{
    switch (value.GetType())
    {
    case VAR_RESOURCEREF:
        AddResourceRef(value.GetResourceRef());
        break;

    case VAR_RESOURCEREFLIST:
        AddResourceRefList(value.GetResourceRefList());
        break;

    case VAR_VARIANTVECTOR:
    case VAR_VARIANTMAP:
        LOGERROR("Unsupported value type");
        break;

    default:
        AddString(value.ToString());
    }
}
        Variant Method::Invoke(
            Variant &instance,
            ArgumentList &arguments
        ) const
        {
        #if defined(_DEBUG)

            UAssert( IsValid( ), 
                "Invalid method invoked." 
            );

            UAssert( !(instance.IsConst( ) && !m_isConst), 
                "Non-const method invoked on const object." 
            );

            UAssert( instance.GetType( ) == m_classType, 
                "Incompatible method invoked with instance." 
            );

        #endif

            return m_invoker->Invoke( instance, arguments );
        }
Example #21
0
bool Serializer::WriteVariantData(const Variant& value)
{
    switch (value.GetType())
    {
    case VAR_NONE:
        return true;

    case VAR_INT:
        return WriteInt(value.GetInt());

    case VAR_BOOL:
        return WriteBool(value.GetBool());

    case VAR_FLOAT:
        return WriteFloat(value.GetFloat());

    case VAR_VECTOR2:
        return WriteVector2(value.GetVector2());

    case VAR_VECTOR3:
        return WriteVector3(value.GetVector3());

    case VAR_VECTOR4:
        return WriteVector4(value.GetVector4());

    case VAR_QUATERNION:
        return WriteQuaternion(value.GetQuaternion());

    case VAR_COLOR:
        return WriteColor(value.GetColor());

    case VAR_STRING:
        return WriteString(value.GetString());

    case VAR_BUFFER:
        return WriteBuffer(value.GetBuffer());

    // Serializing pointers is not supported. Write null
    case VAR_VOIDPTR:
    case VAR_PTR:
        return WriteUInt(0);

    case VAR_RESOURCEREF:
        return WriteResourceRef(value.GetResourceRef());

    case VAR_RESOURCEREFLIST:
        return WriteResourceRefList(value.GetResourceRefList());

    case VAR_VARIANTVECTOR:
        return WriteVariantVector(value.GetVariantVector());

    case VAR_VARIANTMAP:
        return WriteVariantMap(value.GetVariantMap());

    case VAR_INTRECT:
        return WriteIntRect(value.GetIntRect());

    case VAR_INTVECTOR2:
        return WriteIntVector2(value.GetIntVector2());

    case VAR_MATRIX3:
        return WriteMatrix3(value.GetMatrix3());

    case VAR_MATRIX3X4:
        return WriteMatrix3x4(value.GetMatrix3x4());

    case VAR_MATRIX4:
        return WriteMatrix4(value.GetMatrix4());

    default:
        return false;
    }
}
Example #22
0
void ObjectAnimations::MoveToFrame(unsigned int frame)
{
	Variant sval;
	Variant eval;
	unsigned int sframe, eframe;

	for(map<int, set<AnimationKey> >::iterator i = animations.begin(); i!=animations.end(); i++)
	{
		if(i->second.size()==0) continue;
		set<AnimationKey>::iterator end, start;
		end = i->second.upper_bound(frame);
		start = end;
		--start;
		
		if(end==i->second.end())
		{
			sval = start->val;
			sframe = start->frame;
			eval = start->val;
			eframe = start->frame;
		}
		else
		{
			sval = start->val;
			sframe = start->frame;

			eval = end->val;
			eframe = end->frame;
		}

		unsigned int tframes = eframe - sframe;
		if(tframes==0) tframes = 1;
		float t = (frame - sframe) / (float)tframes;

		if(sval.GetType() == Variant::Int && eval.GetType() == Variant::Int)
		{
			int s = sval;
			int e = eval;
			int c = (int)(s + (e - s) * t);
		}
		else if(sval.GetType() == Variant::Float && eval.GetType() == Variant::Float)
		{
			float s = sval;
			float e = eval;
			float c = s + (e - s) * t;

			if(i->first == ANIM_TYPE_POSX)
			{
				if(!obj.IsValid()) return;
				RectangleF& pos = obj.GetObject()->GetObjectArea();
				float width = pos.right - pos.left;
				pos.left = c;
				pos.right = pos.left + width;
			}
			else if(i->first == ANIM_TYPE_POSY)
			{
				if(!obj.IsValid()) return;
				RectangleF& pos = obj.GetObject()->GetObjectArea();
				float height = pos.bottom - pos.top;
				pos.top = c;
				pos.bottom = pos.top + height;
			}
			else if(i->first == ANIM_TYPE_SCALEX)
			{
				if(!obj.IsValid()) return;
				RectangleF& pos = obj.GetObject()->GetObjectArea();
				pos.bottom = pos.top + c;
			}
			else if(i->first == ANIM_TYPE_SCALEY)
			{
				if(!obj.IsValid()) return;
				RectangleF& pos = obj.GetObject()->GetObjectArea();
				pos.bottom = pos.top + c;
			}
			else if(i->first == ANIM_TYPE_ROTATION)
			{
				if(!obj.IsValid()) return;
				obj.GetObject()->SetAngle(c);
			}
			else if(i->first == ANIM_TYPE_CPOSX)
			{
				Game->GetMainContainer()->GetCamera().m_pos.left = c;
				Game->GetMainContainer()->AdjustCamera();
			}
			else if(i->first == ANIM_TYPE_CPOSY)
			{
				Game->GetMainContainer()->GetCamera().m_pos.top = c;
				Game->GetMainContainer()->AdjustCamera();
			}
			else if(i->first == ANIM_TYPE_CZOOM)
			{
				Game->GetMainContainer()->GetCamera().m_zoom = c;
				Game->GetMainContainer()->AdjustCamera();
			}
		}
		else if(sval.GetType() == Variant::UInt && eval.GetType() == Variant::UInt)
		{
			unsigned int s = sval;
			unsigned int e = eval;
			int c = (unsigned int)(s + (e - s) * t);
			if(i->first == ANIM_TYPE_BCOLOR)
			{
				if(!obj.IsValid()) return;
				ColorARGB32 CA(s), CB(e);
				ColorARGB32 CE((unsigned char)(CA.GetA() + (CB.GetA() - CA.GetA()) * t), (unsigned char)(CA.GetR() + (CB.GetR() - CA.GetR()) * t), (unsigned char)(CA.GetG() + (CB.GetG() - CA.GetG()) * t), (unsigned char)(CA.GetB() + (CB.GetB() - CA.GetB()) * t));
				obj.GetObject()->m_backcolor = CE;
			}
		}
	}
}
Example #23
0
void JSONValue::SetVariantValue(const Variant& variant, Context* context)
{
    if (!IsNull())
    {
        LOGWARNING("JsonValue is not null");
    }

    switch (variant.GetType())
    {
    case VAR_BOOL:
        *this = variant.GetBool();
        return;
    
    case VAR_INT:
        *this = variant.GetInt();
        return;

    case VAR_FLOAT:
        *this = variant.GetFloat();
        return;

    case VAR_DOUBLE:
        *this = variant.GetDouble();
        return;

    case VAR_STRING:
        *this = variant.GetString();
        return;

    case VAR_VARIANTVECTOR:
        SetVariantVector(variant.GetVariantVector(), context);
        return;

    case VAR_VARIANTMAP:
        SetVariantMap(variant.GetVariantMap(), context);
        return;

    case VAR_RESOURCEREF:
        {
            if (!context)
            {
                LOGERROR("Context must not null for ResourceRef");
                return;
            }

            const ResourceRef& ref = variant.GetResourceRef();
            *this = String(context->GetTypeName(ref.type_)) + ";" + ref.name_;
        }
        return;

    case VAR_RESOURCEREFLIST:
        {
            if (!context)
            {
                LOGERROR("Context must not null for ResourceRefList");
                return;
            }

            const ResourceRefList& refList = variant.GetResourceRefList();
            String str(context->GetTypeName(refList.type_));
            for (unsigned i = 0; i < refList.names_.Size(); ++i)
            {
                str += ";";
                str += refList.names_[i];
            }
            *this = str;
        }
        return;

    case VAR_STRINGVECTOR:
        {
            const StringVector& vector = variant.GetStringVector();
            Resize(vector.Size());
            for (unsigned i = 0; i < vector.Size(); ++i)
                (*this)[i] = vector[i];
        }
        return;

    default:
        *this = variant.ToString();
    }
}
Example #24
0
void ToluaToVariant(lua_State* L, int narg, void* def, Variant& variant)
{
    switch (lua_type(L, narg))   // Use the type of lua object to determine the final variant type
    {
    case LUA_TNIL:
        variant = Variant::EMPTY;
        break;

    case LUA_TBOOLEAN:
        variant = (bool)lua_toboolean(L, narg);     // Still need to cast to bool as Lua/LuaJIT return it as int
        break;

    case LUA_TNUMBER:
        {
            // Use the original variant type to further determine the final variant type
            // CAVEAT: if lhs has integral data type and double is desired then lhs needs to be reset first before assigning
            double value = lua_tonumber(L, narg);
            switch (variant.GetType())
            {
            case VAR_INT:
                variant = (int)value;
                break;

            case VAR_BOOL:
                variant = value != 0.0f;
                break;

            case VAR_FLOAT:
                variant = (float)value;
                break;

            default:
                variant = value;
            }
        }
        break;

    case LUA_TSTRING:
        variant = lua_tostring(L, narg);
        break;

    case LUA_TUSERDATA:
        {
            if (lua_getmetatable(L, narg))
            {
                lua_rawget(L, LUA_REGISTRYINDEX);     // registry[mt]
                const char* typeName = lua_tostring(L, -1);
                lua_pop(L, 1);

                void* value = tolua_tousertype(L, narg, def);
                switch (Variant::GetTypeFromName(typeName))
                {
                case VAR_NONE:
                    // Handle special cases
                    if (typeName)
                    {
                        tolua_Error error;
                        if (strcmp(typeName, "Variant") == 0)
                            variant = *static_cast<Variant*>(value);
                        else if (strcmp(typeName, "VectorBuffer") == 0)
                            variant = *static_cast<VectorBuffer*>(value);
                        else if (tolua_isusertype(L, narg, "RefCounted", 0, &error))
                            variant = static_cast<RefCounted*>(value);
                        else
                            variant = value;    // void*
                    }
                    break;

                case VAR_VECTOR2:
                    variant = *static_cast<Vector2*>(value);
                    break;

                case VAR_VECTOR3:
                    variant = *static_cast<Vector3*>(value);
                    break;

                case VAR_VECTOR4:
                    variant = *static_cast<Vector4*>(value);
                    break;

                case VAR_QUATERNION:
                    variant = *static_cast<Quaternion*>(value);
                    break;

                case VAR_COLOR:
                    variant = *static_cast<Color*>(value);
                    break;

                case VAR_INTRECT:
                    variant = *static_cast<IntRect*>(value);
                    break;

                case VAR_INTVECTOR2:
                    variant = *static_cast<IntVector2*>(value);
                    break;

                case VAR_MATRIX3:
                    variant = *static_cast<Matrix3*>(value);
                    break;

                case VAR_MATRIX3X4:
                    variant = *static_cast<Matrix3x4*>(value);
                    break;

                case VAR_MATRIX4:
                    variant = *static_cast<Matrix4*>(value);
                    break;

                case VAR_RESOURCEREF:
                    variant = *static_cast<ResourceRef*>(value);
                    break;

                case VAR_RESOURCEREFLIST:
                    variant = *static_cast<ResourceRefList*>(value);
                    break;

                case VAR_VARIANTMAP:
                    variant = *static_cast<VariantMap*>(value);
                    break;

                default: break;
                }
            };
        }
        break;

    case LUA_TTABLE:
        {
            tolua_Error error;
            if (ToluaIsPODVector<unsigned char>(0.f, L, narg, "unsigned char", 0, &error))
                variant = *static_cast<PODVector<unsigned char>*>(ToluaToPODVector<unsigned char>(0.f, L, narg, def));
            else if (ToluaIsVector<Variant>(L, narg, "Variant", 0, &error))
                variant = *static_cast<VariantVector*>(ToluaToVector<Variant>(L, narg, def));
            else if (ToluaIsVector<String>(L, narg, "String", 0, &error))
                variant = *static_cast<StringVector*>(ToluaToVector<String>(L, narg, def));
        }
        break;

    default: break;
    }
}