当前位置: 首页>>代码示例>>C++>>正文


C++ CScriptArgReader::ReadNumber方法代码示例

本文整理汇总了C++中CScriptArgReader::ReadNumber方法的典型用法代码示例。如果您正苦于以下问题:C++ CScriptArgReader::ReadNumber方法的具体用法?C++ CScriptArgReader::ReadNumber怎么用?C++ CScriptArgReader::ReadNumber使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CScriptArgReader的用法示例。


在下文中一共展示了CScriptArgReader::ReadNumber方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: setSunColor

int CLuaWorldDefs::setSunColor ( lua_State* luaVM )
{
    CScriptArgReader argStream ( luaVM );

    unsigned char ucCoreR, ucCoreG, ucCoreB, ucCoronaR, ucCoronaG, ucCoronaB;
    argStream.ReadNumber ( ucCoreR, 0 );
    argStream.ReadNumber ( ucCoreG, 0 );
    argStream.ReadNumber ( ucCoreB, 0 );
    argStream.ReadNumber ( ucCoronaR, ucCoreR );
    argStream.ReadNumber ( ucCoronaG, ucCoreG );
    argStream.ReadNumber ( ucCoronaB, ucCoreB );

    if ( !argStream.HasErrors ( ) )
    {
        if ( CStaticFunctionDefinitions::SetSunColor ( ucCoreR, ucCoreG, ucCoreB, ucCoronaR, ucCoronaG, ucCoronaB ) )
        {
            lua_pushboolean ( luaVM, true );
            return 1;
        }
    }
    else
        m_pScriptDebugging->LogBadType ( luaVM );

    lua_pushboolean ( luaVM, false );
    return 1;
}
开发者ID:pombredanne,项目名称:openvice,代码行数:26,代码来源:CLuaWorldDefs.cpp

示例2: SetBrowserVolume

int CLuaFunctionDefs::SetBrowserVolume ( lua_State* luaVM )
{
//  bool setBrowserVolume ( float volume )
//  bool setBrowserVolume ( browser webBrowser, float volume )
    CClientWebBrowser* pWebBrowser; float fVolume;

    CScriptArgReader argStream ( luaVM );
    if ( argStream.NextIsNumber () )
    {
        argStream.ReadNumber ( fVolume );
        lua_pushboolean ( luaVM, g_pCore->GetWebCore ()->SetGlobalAudioVolume ( fVolume ) );
        return 1;
    }
    
    argStream.ReadUserData ( pWebBrowser );
    argStream.ReadNumber ( fVolume );

    if ( !argStream.HasErrors () )
    {
        lua_pushboolean ( luaVM, pWebBrowser->SetAudioVolume ( fVolume ) );
        return 1;
    }
    else
        m_pScriptDebugging->LogCustom ( luaVM, argStream.GetFullErrorMessage () );

    lua_pushboolean ( luaVM, false );
    return 1;
}
开发者ID:F420,项目名称:mtasa-blue,代码行数:28,代码来源:CLuaFunctionDefs.Browser.cpp

示例3: GetTok

int CLuaFunctionDefs::GetTok ( lua_State* luaVM )
{
    SString strInput = "";
    unsigned int uiToken = 0;
    unsigned int uiDelimiter = 0;
    SString strDelimiter;
    CScriptArgReader argStream ( luaVM );
    argStream.ReadString ( strInput );
    argStream.ReadNumber ( uiToken );

    if ( argStream.NextIsNumber () )
    {
        argStream.ReadNumber ( uiDelimiter );
        wchar_t wUNICODE[2] = { uiDelimiter, '\0' };
        strDelimiter = UTF16ToMbUTF8 ( wUNICODE );
    }
    else  // It's already a string
        argStream.ReadString ( strDelimiter );

    if ( !argStream.HasErrors () )
    {
        if ( uiToken > 0 && uiToken < 1024 )
        {
            unsigned int uiCount = 1;
            char* szText = new char[strInput.length () + 1];
            strcpy ( szText, strInput );
            char* szToken = strtok ( szText, strDelimiter );

            // We're looking for the first part?
            if ( uiToken != 1 )
            {
                // strtok count number of times
                do
                {
                    uiCount++;
                    szToken = strtok ( NULL, strDelimiter );
                } while ( uiCount != uiToken );
            }

            // Found it?
            if ( szToken )
            {
                // Return it
                lua_pushstring ( luaVM, szToken );
                delete[] szText;
                return 1;
            }

            // Delete the text
            delete[] szText;
        }
        else
            m_pScriptDebugging->LogWarning ( luaVM, "Token parameter sent to split must be greater than 0 and smaller than 1024" );
    }
    else
        m_pScriptDebugging->LogCustom ( luaVM, argStream.GetFullErrorMessage () );

    lua_pushboolean ( luaVM, false );
    return 1;
}
开发者ID:AdiBoy,项目名称:mtasa-blue,代码行数:60,代码来源:CLuaFunctionDefs.Utility.cpp

示例4: setHeatHaze

int CLuaWorldDefs::setHeatHaze ( lua_State* luaVM )
{
    CScriptArgReader argStream ( luaVM );

    // Set the new heat haze settings
    SHeatHazeSettings heatHaze;
    argStream.ReadNumber ( heatHaze.ucIntensity );
    argStream.ReadNumber ( heatHaze.ucRandomShift, 0 );
    argStream.ReadNumber ( heatHaze.usSpeedMin, 12 );
    argStream.ReadNumber ( heatHaze.usSpeedMax, 18 );
    argStream.ReadNumber ( heatHaze.sScanSizeX, 75 );
    argStream.ReadNumber ( heatHaze.sScanSizeY, 80 );
    argStream.ReadNumber ( heatHaze.usRenderSizeX, 80 );
    argStream.ReadNumber ( heatHaze.usRenderSizeY, 85 );
    argStream.ReadBool ( heatHaze.bInsideBuilding, false );

    if ( !argStream.HasErrors () )
    {
        if ( CStaticFunctionDefinitions::SetHeatHaze ( heatHaze ) )
        {
            lua_pushboolean ( luaVM, true );
            return 1;
        }
    }
    else
        m_pScriptDebugging->LogBadType ( luaVM );

    // Return false
    lua_pushboolean ( luaVM, false );
    return 1;
}
开发者ID:pombredanne,项目名称:openvice,代码行数:31,代码来源:CLuaWorldDefs.cpp

示例5: InterpolateBetween

int CLuaFunctionDefs::InterpolateBetween ( lua_State* luaVM )
{
    //  float float float interpolateBetween ( float x1, float y1, float z1, 
    //      float x2, float y2, float z2, 
    //      float fProgress, string strEasingType, 
    //      [ float fEasingPeriod, float fEasingAmplitude, float fEasingOvershoot ] )
    CVector vecPointA; CVector vecPointB;
    float fProgress; CEasingCurve::eType easingType;
    float fEasingPeriod; float fEasingAmplitude; float fEasingOvershoot;

    CScriptArgReader argStream ( luaVM );
    argStream.ReadVector3D ( vecPointA );
    argStream.ReadVector3D ( vecPointB );
    argStream.ReadNumber ( fProgress );
    argStream.ReadEnumString ( easingType );
    argStream.ReadNumber ( fEasingPeriod, 0.3f );
    argStream.ReadNumber ( fEasingAmplitude, 1.0f );
    argStream.ReadNumber ( fEasingOvershoot, 1.70158f );

    if ( argStream.HasErrors () )
    {
        m_pScriptDebugging->LogCustom ( luaVM, argStream.GetFullErrorMessage () );
        lua_pushboolean ( luaVM, false );
        return 1;
    }

    CVector vecResult = TInterpolation < CVector >::Interpolate ( vecPointA, vecPointB, fProgress, easingType, fEasingPeriod, fEasingAmplitude, fEasingOvershoot );
    lua_pushnumber ( luaVM, vecResult.fX );
    lua_pushnumber ( luaVM, vecResult.fY );
    lua_pushnumber ( luaVM, vecResult.fZ );
    return 3;
}
开发者ID:AdiBoy,项目名称:mtasa-blue,代码行数:32,代码来源:CLuaFunctionDefs.Utility.cpp

示例6: SetLightColor

int CLuaPointLightDefs::SetLightColor ( lua_State* luaVM )
{
    //  bool setLightColor ( light theLight, float r, float g, float b )
    CClientPointLights* pLight;
    float fRed;
    float fGreen;
    float fBlue;

    CScriptArgReader argStream ( luaVM );
    argStream.ReadUserData ( pLight );
    argStream.ReadNumber ( fRed );
    argStream.ReadNumber ( fGreen );
    argStream.ReadNumber ( fBlue );

    if ( !argStream.HasErrors () )
    {
        SColorRGBA color ( fRed, fGreen, fBlue, 0 );
        if ( CStaticFunctionDefinitions::SetLightColor ( pLight, color ) )
        {
            lua_pushboolean ( luaVM, true );
            return 1;
        }
    }
    else
        m_pScriptDebugging->LogCustom ( luaVM, SString ( "Bad argument @ '%s' [%s]", lua_tostring ( luaVM, lua_upvalueindex ( 1 ) ), *argStream.GetErrorMessage () ) );

    lua_pushboolean ( luaVM, false );
    return 1;
}
开发者ID:qaisjp,项目名称:mtasa-blue,代码行数:29,代码来源:CLuaPointLightDefs.cpp

示例7: SetWeaponProperty

int CLuaFunctionDefs::SetWeaponProperty ( lua_State* luaVM )
{
    CClientWeapon * pWeapon;
    eWeaponProperty weaponProperty;
    CScriptArgReader argStream ( luaVM );
    argStream.ReadUserData ( pWeapon );
    argStream.ReadEnumString ( weaponProperty );

    if ( !argStream.HasErrors () )
    {
        if ( weaponProperty == WEAPON_DAMAGE )
        {
            short sData = 0;
            argStream.ReadNumber( sData );
            if ( !argStream.HasErrors( ) )
            {
                if ( CStaticFunctionDefinitions::SetWeaponProperty ( pWeapon, weaponProperty, sData ) )
                {
                    lua_pushboolean ( luaVM, true );
                    return 1;
                }
            }
        }
        else
        if ( weaponProperty == WEAPON_FIRE_ROTATION )
        {
            CVector vecRotation;
            argStream.ReadVector3D ( vecRotation );
            if ( !argStream.HasErrors () )
            {
                if ( CStaticFunctionDefinitions::SetWeaponProperty ( pWeapon, weaponProperty, vecRotation ) )
                {
                    lua_pushboolean ( luaVM, true );
                    return 1;
                }
            }
        }
        else
        {
            float fData = 0.0f;
            argStream.ReadNumber( fData );
            if ( !argStream.HasErrors( ) )
            {
                if ( CStaticFunctionDefinitions::SetWeaponProperty ( pWeapon, weaponProperty, fData ) )
                {
                    lua_pushboolean ( luaVM, true );
                    return 1;
                }
            }
        }
    }
    if ( argStream.HasErrors () )
        m_pScriptDebugging->LogCustom ( luaVM, argStream.GetFullErrorMessage() );

    lua_pushboolean ( luaVM, false );
    return 1;
}
开发者ID:AdiBoy,项目名称:mtasa-blue,代码行数:57,代码来源:CLuaFunctionDefs.Weapon.cpp

示例8: argStream

int CLuaVector2Defs::Create ( lua_State* luaVM )
{
    CVector2D vector;

    CScriptArgReader argStream ( luaVM );
    if ( argStream.NextIsTable () )
    {
        lua_pushvalue ( luaVM, 1 );

        lua_pushstring ( luaVM, "x" );
        lua_rawget ( luaVM, -2 );
        if ( lua_isnumber ( luaVM, -1 ) )
        {
            vector.fX = ( float ) lua_tonumber ( luaVM, -1 );
            lua_pop ( luaVM, 1 );
        }
        else
        {
            lua_pop ( luaVM, 1 );
            lua_rawgeti ( luaVM, -1, 1 );
            if ( lua_isnumber ( luaVM, -1 ) )
                vector.fX = ( float ) lua_tonumber ( luaVM, -1 );
            lua_pop ( luaVM, 1 );
        }

        lua_pushstring ( luaVM, "y" );
        lua_rawget ( luaVM, -2 );
        if ( lua_isnumber ( luaVM, -1 ) )
        {
            vector.fY = ( float ) lua_tonumber ( luaVM, -1 );
            lua_pop ( luaVM, 1 );
        }
        else
        {
            lua_pop ( luaVM, 1 );
            lua_rawgeti ( luaVM, -1, 2 );
            if ( lua_isnumber ( luaVM, -1 ) )
                vector.fY = ( float ) lua_tonumber ( luaVM, -1 );
            lua_pop ( luaVM, 1 );
        }
    }
    else if ( argStream.NextIsNumber () )
    {
        argStream.ReadNumber ( vector.fX );
        if ( argStream.NextIsNumber () )
        {
            argStream.ReadNumber ( vector.fY );
        }
    }
    else if ( argStream.NextIsVector2D () )
    {
        argStream.ReadVector2D ( vector );
    }

    lua_pushvector ( luaVM, vector );
    return 1;
}
开发者ID:Jusonex,项目名称:mtasa-blue,代码行数:57,代码来源:CLuaVector2Defs.cpp

示例9: argStream

int CLuaFunctionDefs::PlaySound3D ( lua_State* luaVM )
{
    SString strSound = "";
    CVector vecPosition;
    CScriptArgReader argStream ( luaVM );
    argStream.ReadString ( strSound );
    argStream.ReadNumber ( vecPosition.fX );
    argStream.ReadNumber ( vecPosition.fY );
    argStream.ReadNumber ( vecPosition.fZ );

    if ( !argStream.HasErrors() )
    {
        CLuaMain * luaMain = m_pLuaManager->GetVirtualMachine ( luaVM );
        if ( luaMain )
        {
            CResource* pResource = luaMain->GetResource();
            if ( pResource )
            {
                SString strFilename;
                bool bIsURL = false;
                if ( CResourceManager::ParseResourcePathInput( strSound, pResource, strFilename ) )
                    strSound = strFilename;
                else
                    bIsURL = true;

                // ParseResourcePathInput changes pResource in some cases e.g. an invalid resource URL - crun playSound( ":myNotRunningResource/music/track.mp3" )
                // Fixes #6507 - Caz
                if ( pResource )
                {
                    bool bLoop = false;
                    if ( argStream.NextIsBool ( ) )
                    {
                        argStream.ReadBool ( bLoop );
                    }

                    CClientSound* pSound = CStaticFunctionDefinitions::PlaySound3D ( pResource, strSound, bIsURL, vecPosition, bLoop );
                    if ( pSound )
                    {
                        // call onClientSoundStarted
                        CLuaArguments Arguments;
                        Arguments.PushString ( "play" );     // Reason
                        pSound->CallEvent ( "onClientSoundStarted", Arguments, false );

                        lua_pushelement ( luaVM, pSound );
                        return 1;
                    }
                }
            }
        }
    }
    else
        m_pScriptDebugging->LogCustom ( luaVM, argStream.GetFullErrorMessage() );

    lua_pushboolean ( luaVM, false );
    return 1;
}
开发者ID:ntauthority,项目名称:openvice,代码行数:56,代码来源:CLuaFunctionDefs.Audio.cpp

示例10: SetWeaponTarget

int CLuaFunctionDefs::SetWeaponTarget ( lua_State* luaVM )
{
    CClientWeapon * pWeapon;
    CClientEntity * pTarget;
    CScriptArgReader argStream ( luaVM );
    argStream.ReadUserData ( pWeapon );
    if ( argStream.NextIsUserData() )
    {
        int targetBone;
        argStream.ReadUserData ( pTarget );
        argStream.ReadNumber ( targetBone, 255 );
        if ( !argStream.HasErrors () )
        {
            if ( CStaticFunctionDefinitions::SetWeaponTarget ( pWeapon, pTarget, targetBone ) )
            {
                lua_pushboolean ( luaVM, true );
                return 1;
            }
        }
    }
    else if ( argStream.NextIsNumber() )
    {
        CVector vecTarget;
        argStream.ReadNumber( vecTarget.fX );
        argStream.ReadNumber( vecTarget.fY );
        argStream.ReadNumber( vecTarget.fZ );
        if ( !argStream.HasErrors () )
        {
            if ( CStaticFunctionDefinitions::SetWeaponTarget ( pWeapon, vecTarget ) )
            {
                lua_pushboolean ( luaVM, true );
                return 1;
            }
        }
    }
    else if ( argStream.NextIsNil() )
    {
        if ( !argStream.HasErrors () )
        {
            if ( CStaticFunctionDefinitions::ClearWeaponTarget ( pWeapon ) )
            {
                lua_pushboolean ( luaVM, true );
                return 1;
            }
        }
    }
    else
        argStream.SetCustomError( "Expected element, number or nil at argument 2" );

    if ( argStream.HasErrors () )
        m_pScriptDebugging->LogCustom ( luaVM, argStream.GetFullErrorMessage() );

    lua_pushboolean ( luaVM, false );
    return 1;
}
开发者ID:ntauthority,项目名称:openvice,代码行数:55,代码来源:CLuaFunctionDefs.Weapon.cpp

示例11: SetWeaponAmmo

int CLuaFunctionDefs::SetWeaponAmmo ( lua_State* luaVM )
{
    // bool setWeaponAmmo ( player thePlayer, int weapon, int totalAmmo, [int ammoInClip = 0] )
    CElement* pElement;
    eWeaponType weaponType;
    ushort usAmmo;
    ushort usAmmoInClip;
    CCustomWeapon * pWeapon = NULL;

    CScriptArgReader argStream ( luaVM );
    argStream.ReadUserData ( pElement );

    if ( !argStream.HasErrors () )
    {
        if ( pElement->GetType () != CElement::WEAPON )
        {
            argStream.ReadEnumStringOrNumber ( weaponType );
            argStream.ReadNumber ( usAmmo );
            argStream.ReadNumber ( usAmmoInClip, 0 );

            if ( !argStream.HasErrors () )
            {
                if ( CStaticFunctionDefinitions::SetWeaponAmmo ( pElement, weaponType, usAmmo, usAmmoInClip ) )
                {
                    lua_pushboolean ( luaVM, true );
                    return 1;
                }
            }
            else
                m_pScriptDebugging->LogCustom ( luaVM, argStream.GetFullErrorMessage () );
        }
        else
        {
            pWeapon = static_cast <CCustomWeapon *> ( pElement );
            argStream.ReadNumber ( usAmmo );

            if ( !argStream.HasErrors () )
            {
                if ( CStaticFunctionDefinitions::SetWeaponAmmo ( pWeapon, usAmmo ) )
                {
                    lua_pushboolean ( luaVM, true );
                    return 1;
                }
            }
            else
                m_pScriptDebugging->LogCustom ( luaVM, argStream.GetFullErrorMessage () );
        }
    }
    else
        m_pScriptDebugging->LogCustom ( luaVM, argStream.GetFullErrorMessage () );

    lua_pushboolean ( luaVM, false );
    return 1;
}
开发者ID:F420,项目名称:mtasa-blue,代码行数:54,代码来源:CLuaFunctionDefs.Weapon.cpp

示例12: argStream

int CLuaVector4Defs::Mul ( lua_State* luaVM )
{
    CScriptArgReader argStream ( luaVM );
    CLuaVector4D* pVector1 = NULL;

    if ( argStream.NextIsNumber ( ) )
    {
        // number * vector4
        float fValue = 0.0f;
        argStream.ReadNumber ( fValue );
        argStream.ReadUserData ( pVector1 );

        if ( !argStream.HasErrors ( ) )
        {
            lua_pushvector ( luaVM, *pVector1 * fValue );
            return 1;
        }
        else
            m_pScriptDebugging->LogCustom ( luaVM, argStream.GetFullErrorMessage ( ) );
    }
    else
    {
        // vector4 * ?
        argStream.ReadUserData ( pVector1 );
        if ( argStream.NextIsNumber ( ) )
        {
            float fValue = 0.0f;
            argStream.ReadNumber ( fValue );
            if ( !argStream.HasErrors ( ) )
            {
                lua_pushvector ( luaVM, *pVector1 * fValue );
                return 1;
            }
            else
                m_pScriptDebugging->LogCustom ( luaVM, argStream.GetFullErrorMessage ( ) );
        }
        else
        {
            CLuaVector4D* pVector2 = NULL;
            argStream.ReadUserData ( pVector2 );

            if ( !argStream.HasErrors ( ) )
            {
                lua_pushvector ( luaVM, *pVector1 * *pVector2 );
                return 1;
            }
            else
                m_pScriptDebugging->LogCustom ( luaVM, argStream.GetFullErrorMessage ( ) );
        }
    }

    lua_pushboolean ( luaVM, false );
    return 1;
}
开发者ID:leopasquali,项目名称:old_multitheftauto,代码行数:54,代码来源:CLuaVector4Defs.cpp

示例13: OutputDebugString

int CLuaFunctionDefs::OutputDebugString ( lua_State* luaVM )
{
    SString strMessage;
    unsigned int uiLevel;
    unsigned char ucR, ucG, ucB;

    CScriptArgReader argStream ( luaVM );
    argStream.ReadString ( strMessage );
    argStream.ReadNumber ( uiLevel, 3 );

    if ( uiLevel == 0 )
    {
        argStream.ReadNumber ( ucR, 0xFF );
        argStream.ReadNumber ( ucG, 0xFF );
        argStream.ReadNumber ( ucB, 0xFF );
    }

    if ( !argStream.HasErrors () )
    {
        if ( uiLevel > 3 )
        {
            m_pScriptDebugging->LogWarning ( luaVM, "Bad level argument sent to %s (0-3)", lua_tostring ( luaVM, lua_upvalueindex ( 1 ) ) );

            lua_pushboolean ( luaVM, false );
            return 1;
        }

        if ( uiLevel == 1 )
        {
            m_pScriptDebugging->LogError ( luaVM, "%s", strMessage.c_str () );
        }
        else if ( uiLevel == 2 )
        {
            m_pScriptDebugging->LogWarning ( luaVM, "%s", strMessage.c_str () );
        }
        else if ( uiLevel == 3 )
        {
            m_pScriptDebugging->LogInformation ( luaVM, "%s", strMessage.c_str () );
        }
        else if ( uiLevel == 0 )
        {
            m_pScriptDebugging->LogCustom ( luaVM, ucR, ucG, ucB, "%s", strMessage.c_str () );
        }
        lua_pushboolean ( luaVM, true );
        return 1;
    }
    else
        m_pScriptDebugging->LogCustom ( luaVM, argStream.GetFullErrorMessage () );

    lua_pushboolean ( luaVM, false );
    return 1;
}
开发者ID:Bargas,项目名称:mtasa-blue,代码行数:52,代码来源:CLuaFunctionDefs.Server.cpp

示例14: SetPlayerNametagColor

int CLuaPlayerDefs::SetPlayerNametagColor ( lua_State* luaVM )
{
    CScriptArgReader argStream ( luaVM );
    if ( !argStream.NextIsBool ( 1 ) )
    {
        // Call type 1
        //  bool setPlayerNametagColor ( player thePlayer, int r, int g, int b )
        CClientEntity* pPlayer; int iR; int iG; int iB;

        argStream.ReadUserData ( pPlayer );
        argStream.ReadNumber ( iR );
        argStream.ReadNumber ( iG );
        argStream.ReadNumber ( iB );

        if ( !argStream.HasErrors () )
        {
            if ( CStaticFunctionDefinitions::SetPlayerNametagColor ( *pPlayer, false, iR, iG, iB ) )
            {
                lua_pushboolean ( luaVM, true );
                return 1;
            }
        }
    }
    else
    {
        // Call type 2
        //  bool setPlayerNametagColor ( player thePlayer, false )
        CClientEntity* pPlayer; bool bFalse;

        argStream.ReadUserData ( pPlayer );
        argStream.ReadBool ( bFalse );

        if ( !argStream.HasErrors () )
        {
            if ( bFalse == false )
            {
                if ( CStaticFunctionDefinitions::SetPlayerNametagColor ( *pPlayer, true, 255, 255, 255 ) )
                {
                    lua_pushboolean ( luaVM, true );
                    return 1;
                }
            }
        }
    }

    if ( argStream.HasErrors () )
        m_pScriptDebugging->LogCustom ( luaVM, argStream.GetFullErrorMessage () );

    lua_pushboolean ( luaVM, false );
    return 1;
}
开发者ID:Anubhav652,项目名称:mtasa-blue,代码行数:51,代码来源:CLuaPlayerDefs.cpp

示例15: MoveObject

int CLuaFunctionDefs::MoveObject ( lua_State* luaVM )
{
//  bool moveObject ( object theObject, int time, float targetx, float targety, float targetz,
//      [ float moverx, float movery, float moverz, string strEasingType, float fEasingPeriod, float fEasingAmplitude, float fEasingOvershoot ] )
    CClientEntity* pEntity; int iTime; CVector vecTargetPosition; CVector vecTargetRotation;
    CEasingCurve::eType easingType; float fEasingPeriod; float fEasingAmplitude; float fEasingOvershoot;

    CScriptArgReader argStream ( luaVM );
    argStream.ReadUserData ( pEntity );
    argStream.ReadNumber ( iTime );
    argStream.ReadNumber ( vecTargetPosition.fX );
    argStream.ReadNumber ( vecTargetPosition.fY );
    argStream.ReadNumber ( vecTargetPosition.fZ );
    argStream.ReadNumber ( vecTargetRotation.fX, 0 );
    argStream.ReadNumber ( vecTargetRotation.fY, 0 );
    argStream.ReadNumber ( vecTargetRotation.fZ, 0 );
    argStream.ReadEnumString ( easingType, CEasingCurve::Linear );
    argStream.ReadNumber ( fEasingPeriod, 0.3f );
    argStream.ReadNumber ( fEasingAmplitude, 1.0f );
    argStream.ReadNumber ( fEasingOvershoot, 1.70158f );

    if ( !argStream.HasErrors () )
    {
        if ( CStaticFunctionDefinitions::MoveObject ( *pEntity, iTime, vecTargetPosition, vecTargetRotation, easingType, fEasingPeriod, fEasingAmplitude, fEasingOvershoot ) )
        {
            lua_pushboolean ( luaVM, true );
            return 1;
        }
    }
    else
        m_pScriptDebugging->LogCustom ( luaVM, argStream.GetFullErrorMessage() );

    lua_pushboolean ( luaVM, false );
    return 1;
}
开发者ID:Jusonex,项目名称:mtasa-awesomium,代码行数:35,代码来源:CLuaFunctionDefs.Object.cpp


注:本文中的CScriptArgReader::ReadNumber方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。