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


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

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


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

示例1: SetMapName

int CLuaFunctionDefs::SetMapName ( lua_State* luaVM )
{
    //  bool setMapName ( string mapName )
    SString strMapName;

    CScriptArgReader argStream ( luaVM );
    argStream.ReadIfNextIsString ( strMapName, "" );    // Default to empty for backward compat with previous implementation

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

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

示例2: FetchRemote

// Call a function on a remote server
int CLuaFunctionDefs::FetchRemote ( lua_State* luaVM )
{
    //  bool fetchRemote ( string URL [, string queueName ][, int connectionAttempts = 10, int connectTimeout = 10000 ], callback callbackFunction, [ string postData, bool bPostBinary, arguments... ] )
    CScriptArgReader argStream ( luaVM );
    SString strURL; SString strQueueName; CLuaFunctionRef iLuaFunction; SString strPostData; bool bPostBinary; CLuaArguments args; uint uiConnectionAttempts; uint uiConnectTimeoutMs;

    argStream.ReadString ( strURL );
    if ( argStream.NextIsString () )
        MinServerReqCheck ( argStream, MIN_SERVER_REQ_CALLREMOTE_QUEUE_NAME, "'queue name' is being used" );
    argStream.ReadIfNextIsString ( strQueueName, CALL_REMOTE_DEFAULT_QUEUE_NAME );
    if ( argStream.NextIsNumber () )
        MinServerReqCheck ( argStream, MIN_SERVER_REQ_CALLREMOTE_CONNECTION_ATTEMPTS, "'connection attempts' is being used" );
    argStream.ReadIfNextIsNumber ( uiConnectionAttempts, 10 );
    if ( argStream.NextIsNumber () )
        MinServerReqCheck ( argStream, MIN_SERVER_REQ_CALLREMOTE_CONNECT_TIMEOUT, "'connect timeout' is being used" );
    argStream.ReadIfNextIsNumber ( uiConnectTimeoutMs, 10000 );
    argStream.ReadFunction ( iLuaFunction );
    argStream.ReadString ( strPostData, "" );
    argStream.ReadBool ( bPostBinary, false );
    argStream.ReadLuaArguments ( args );
    argStream.ReadFunctionComplete ();

    if ( !argStream.HasErrors () )
    {
        CLuaMain * luaMain = m_pLuaManager->GetVirtualMachine ( luaVM );
        if ( luaMain )
        {
            g_pGame->GetRemoteCalls ()->Call ( strURL, &args, strPostData, bPostBinary, luaMain, iLuaFunction, strQueueName, uiConnectionAttempts, uiConnectTimeoutMs );
            lua_pushboolean ( luaVM, true );
            return 1;
        }
    }
    else
        m_pScriptDebugging->LogCustom ( luaVM, argStream.GetFullErrorMessage () );

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


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