本文整理汇总了C#中ILuaState.L_CheckAny方法的典型用法代码示例。如果您正苦于以下问题:C# ILuaState.L_CheckAny方法的具体用法?C# ILuaState.L_CheckAny怎么用?C# ILuaState.L_CheckAny使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ILuaState
的用法示例。
在下文中一共展示了ILuaState.L_CheckAny方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: B_GetMetaTable
public static int B_GetMetaTable( ILuaState lua )
{
lua.L_CheckAny( 1 );
if( !lua.GetMetaTable( 1 ) )
{
lua.PushNil();
return 1; // no metatable
}
lua.L_GetMetaField( 1, "__metatable" );
return 1;
}
示例2: B_ToString
public static int B_ToString( ILuaState lua )
{
lua.L_CheckAny( 1 );
lua.L_ToString( 1 );
return 1;
}
示例3: B_ToNumber
public static int B_ToNumber( ILuaState lua )
{
LuaType t = lua.Type( 2 );
if( t == LuaType.LUA_TNONE || t == LuaType.LUA_TNIL ) // standard conversion
{
bool isnum;
double n = lua.ToNumberX( 1, out isnum );
if( isnum )
{
lua.PushNumber( n );
return 1;
} // else not a number; must be something
lua.L_CheckAny( 1 );
}
else
{
string s = lua.L_CheckString( 1 );
int numBase = lua.L_CheckInteger( 2 );
bool negative = false;
lua.L_ArgCheck( (2 <= numBase && numBase <= 36), 2,
"base out of range" );
s = s.Trim( ' ', '\f', '\n', '\r', '\t', '\v' );
s = s + '\0'; // guard
int pos = 0;
if(s[pos] == '-') { pos++; negative = true; }
else if(s[pos] == '+') pos++;
if( Char.IsLetterOrDigit( s, pos ) )
{
double n = 0.0;
do
{
int digit;
if( Char.IsDigit( s, pos ) )
digit = Int32.Parse( s[pos].ToString() );
else
digit = Char.ToUpper( s[pos] ) - 'A' + 10;
if( digit >= numBase )
break; // invalid numeral; force a fail
n = n * (double)numBase + (double)digit;
pos++;
} while( Char.IsLetterOrDigit( s, pos ) );
if( pos == s.Length - 1 ) // except guard, no invalid trailing characters?
{
lua.PushNumber( negative ? -n : n );
return 1;
} // else not a number
} // else not a number
}
lua.PushNil(); // not a number
return 1;
}
示例4: B_RawSet
public static int B_RawSet( ILuaState lua )
{
lua.L_CheckType( 1, LuaType.LUA_TTABLE );
lua.L_CheckAny( 2 );
lua.L_CheckAny( 3 );
lua.SetTop( 3 );
lua.RawSet( 1 );
return 1;
}
示例5: B_RawEqual
public static int B_RawEqual( ILuaState lua )
{
lua.L_CheckAny( 1 );
lua.L_CheckAny( 2 );
lua.PushBoolean( lua.RawEqual( 1, 2 ) );
return 1;
}
示例6: B_PCall
public static int B_PCall( ILuaState lua )
{
lua.L_CheckAny( 1 );
lua.PushNil();
lua.Insert( 1 ); // create space for status result
ThreadStatus status = lua.PCallK( lua.GetTop() - 2,
LuaDef.LUA_MULTRET, 0, 0, PCallContinuation );
return FinishPCall( lua, status == ThreadStatus.LUA_OK );
}