本文整理汇总了C++中CScriptArgReader::NextIsNone方法的典型用法代码示例。如果您正苦于以下问题:C++ CScriptArgReader::NextIsNone方法的具体用法?C++ CScriptArgReader::NextIsNone怎么用?C++ CScriptArgReader::NextIsNone使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CScriptArgReader
的用法示例。
在下文中一共展示了CScriptArgReader::NextIsNone方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetAccount
int CLuaFunctionDefs::GetAccount ( lua_State* luaVM )
{
// account getAccount ( string username, [ string password ] )
SString strName; SString strPassword;
bool bUsePassword = false;
CScriptArgReader argStream ( luaVM );
argStream.ReadString ( strName );
if ( !argStream.NextIsNil () && !argStream.NextIsNone () )
{
argStream.ReadString ( strPassword );
bUsePassword = true;
}
if ( !argStream.HasErrors () )
{
CAccount* pAccount = CStaticFunctionDefinitions::GetAccount ( strName, bUsePassword ? strPassword.c_str () : NULL );
if ( pAccount )
{
lua_pushaccount ( luaVM, pAccount );
return 1;
}
}
else
m_pScriptDebugging->LogCustom ( luaVM, argStream.GetFullErrorMessage () );
lua_pushboolean ( luaVM, false );
return 1;
}
示例2: SetAnalogControlState
int CLuaFunctionDefs::SetAnalogControlState ( lua_State * luaVM )
{
// bool setAnalogControlState ( string controlName [, float state] )
SString strControlState = "";
float fState = 0.0f;
CScriptArgReader argStream ( luaVM );
argStream.ReadString ( strControlState );
if ( !argStream.HasErrors () )
{
if ( argStream.NextIsNumber ( ) )
{
argStream.ReadNumber ( fState );
if ( CClientPad::SetAnalogControlState ( strControlState , fState ) )
{
lua_pushboolean ( luaVM, true );
return 1;
}
}
else if ( argStream.NextIsNone ( ) )
{
CClientPad::RemoveSetAnalogControlState ( strControlState );
lua_pushboolean ( luaVM, true );
return 1;
}
else
m_pScriptDebugging->LogBadType ( luaVM );
}
else
m_pScriptDebugging->LogCustom ( luaVM, argStream.GetFullErrorMessage() );
lua_pushboolean ( luaVM, false );
return 1;
}
示例3: FocusBrowser
int CLuaFunctionDefs::FocusBrowser ( lua_State* luaVM )
{
// focusBrowser ( browser webBrowser )
CClientWebBrowser* pWebBrowser;
CScriptArgReader argStream ( luaVM );
if ( argStream.NextIsNil () || argStream.NextIsNone () )
{
g_pCore->GetWebCore ()->SetFocusedWebView ( NULL );
lua_pushboolean ( luaVM, true );
return 1;
}
argStream.ReadUserData ( pWebBrowser );
if ( !argStream.HasErrors () )
{
pWebBrowser->Focus ();
lua_pushboolean ( luaVM, true );
return 1;
}
else
m_pScriptDebugging->LogCustom ( luaVM, argStream.GetFullErrorMessage () );
lua_pushboolean ( luaVM, false );
return 1;
}
示例4: MixedReadGuiFontString
//
// GuiFont/string
//
void MixedReadGuiFontString ( CScriptArgReader& argStream, SString& strOutFontName, const char* szDefaultFontName, CClientGuiFont*& poutGuiFontElement )
{
poutGuiFontElement = NULL;
if ( argStream.NextIsString () || argStream.NextIsNone () )
argStream.ReadString ( strOutFontName, szDefaultFontName );
else
argStream.ReadUserData ( poutGuiFontElement );
}
示例5: Reference
int CLuaFunctionDefs::Reference ( lua_State* luaVM )
{
CScriptArgReader argStream ( luaVM );
if ( !argStream.NextIsNil () && !argStream.NextIsNone () )
{
int iPointer = lua_ref ( luaVM, 1 );
lua_pushnumber ( luaVM, iPointer );
return 1;
}
lua_pushboolean ( luaVM, false );
return 1;
}
示例6: MixedReadDxFontString
//
// DxFont/string
//
void MixedReadDxFontString(CScriptArgReader& argStream, eFontType& outFontType, eFontType defaultFontType, CClientDxFont*& poutDxFontElement)
{
outFontType = FONT_DEFAULT;
poutDxFontElement = NULL;
if (argStream.NextIsNone())
return;
else if (argStream.NextIsString())
{
SString strFontName;
argStream.ReadString(strFontName);
StringToEnum(strFontName, outFontType);
return;
}
else
argStream.ReadUserData(poutDxFontElement);
}
示例7: GetCommandHandlers
int CLuaFunctionDefs::GetCommandHandlers ( lua_State* luaVM )
{
// table getCommandHandlers ( [ resource sourceResource ] );
CResource* pResource;
bool bSpecificResource = false;
CScriptArgReader argStream ( luaVM );
if ( !argStream.NextIsNone() )
{
argStream.ReadUserData ( pResource );
bSpecificResource = true;
}
if ( !argStream.HasErrors() )
{
if ( bSpecificResource )
{
// Grab resource virtual machine
CLuaMain* pLuaMain = pResource->GetVirtualMachine ();
if ( pLuaMain )
{
m_pRegisteredCommands->GetCommands( luaVM, pLuaMain );
return 1;
}
}
else
{
m_pRegisteredCommands->GetCommands( luaVM );
return 1;
}
}
else
m_pScriptDebugging->LogCustom ( luaVM, argStream.GetFullErrorMessage () );
lua_pushboolean ( luaVM, false );
return 1;
}
示例8: Create
int CLuaMatrixDefs::Create ( lua_State* luaVM )
{
CMatrix matrix;
CScriptArgReader argStream ( luaVM );
if ( argStream.NextIsVector3D () )
{
CVector vecPosition;
argStream.ReadVector3D ( vecPosition );
if ( argStream.NextIsVector3D () )
{
CVector vecRotation;
argStream.ReadVector3D ( vecRotation );
ConvertDegreesToRadiansNoWrap ( vecRotation );
matrix = CMatrix ( vecPosition, vecRotation );
}
else
{
matrix = CMatrix ( vecPosition );
}
}
else if ( argStream.NextIsUserDataOfType<CLuaMatrix> () )
{
argStream.ReadMatrix ( matrix );
matrix = CMatrix ( matrix );
}
else if ( !argStream.NextIsNone() ) {
argStream.SetCustomError ( "Expected vector3, matrix or nothing" );
m_pScriptDebugging->LogCustom ( luaVM, argStream.GetFullErrorMessage () );
lua_pushboolean ( luaVM, false );
return 1;
}
lua_pushmatrix ( luaVM, matrix );
return 1;
}
示例9: SetBrowserAjaxHandler
int CLuaFunctionDefs::SetBrowserAjaxHandler ( lua_State* luaVM )
{
// bool setBrowserAjaxHandler ( browser browser, string URL[, function callback] )
CClientWebBrowser* pWebBrowser; SString strURL; CLuaFunctionRef callbackFunction;
CScriptArgReader argStream ( luaVM );
argStream.ReadUserData ( pWebBrowser );
argStream.ReadString ( strURL );
if ( argStream.NextIsNil () || argStream.NextIsNone () )
{
if ( !argStream.HasErrors () )
{
lua_pushboolean ( luaVM, pWebBrowser->RemoveAjaxHandler ( strURL ) );
return 1;
}
else
m_pScriptDebugging->LogCustom ( luaVM, argStream.GetFullErrorMessage () );
}
else
{
argStream.ReadFunction ( callbackFunction );
argStream.ReadFunctionComplete ();
if ( !argStream.HasErrors () )
{
CLuaMain* pLuaMain = m_pLuaManager->GetVirtualMachine ( luaVM );
if ( pLuaMain && VERIFY_FUNCTION ( callbackFunction ) )
{
CResource* pResource = pLuaMain->GetResource ();
CResourceManager * pResourceManager = m_pResourceManager;
auto netId = pResource->GetNetID ();
bool bResult = pWebBrowser->AddAjaxHandler ( strURL,
[=] ( std::vector<SString>& vecGet, std::vector<SString>& vecPost ) -> const SString
{
// Make sure the resource is still running
if ( !pResourceManager->Exists ( pResource ) || pResource->GetNetID() != netId )
{
return "";
}
// Make sure the function is valid
if ( VERIFY_FUNCTION ( callbackFunction ) )
{
CLuaArguments arguments;
CLuaArguments getArguments;
CLuaArguments postArguments;
for ( auto&& param : vecGet )
getArguments.PushString ( param );
for ( auto&& param : vecPost )
postArguments.PushString ( param );
arguments.PushTable ( &getArguments );
arguments.PushTable ( &postArguments );
CLuaArguments result;
arguments.Call ( pLuaMain, callbackFunction, &result );
if ( result.Count () == 0 )
return "";
CLuaArgument* returnedValue = *result.IterBegin ();
if ( returnedValue->GetType () == LUA_TSTRING )
return returnedValue->GetString ();
else
return "";
}
else
return "";
} );
lua_pushboolean ( luaVM, bResult );
return 1;
}
}
else
m_pScriptDebugging->LogCustom ( luaVM, argStream.GetFullErrorMessage () );
}
lua_pushboolean ( luaVM, false );
return 1;
}