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


C# ILuaState.L_CheckAny方法代码示例

本文整理汇总了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;
 }
开发者ID:matthewyang,项目名称:UniLua,代码行数:11,代码来源:LuaBaseLib.cs

示例2: B_ToString

 public static int B_ToString( ILuaState lua )
 {
     lua.L_CheckAny( 1 );
     lua.L_ToString( 1 );
     return 1;
 }
开发者ID:matthewyang,项目名称:UniLua,代码行数:6,代码来源:LuaBaseLib.cs

示例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;
 }
开发者ID:matthewyang,项目名称:UniLua,代码行数:51,代码来源:LuaBaseLib.cs

示例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;
 }
开发者ID:matthewyang,项目名称:UniLua,代码行数:9,代码来源:LuaBaseLib.cs

示例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;
 }
开发者ID:matthewyang,项目名称:UniLua,代码行数:7,代码来源:LuaBaseLib.cs

示例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 );
        }
开发者ID:matthewyang,项目名称:UniLua,代码行数:11,代码来源:LuaBaseLib.cs


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