本文整理汇总了C#中ILuaState.L_CheckStack方法的典型用法代码示例。如果您正苦于以下问题:C# ILuaState.L_CheckStack方法的具体用法?C# ILuaState.L_CheckStack怎么用?C# ILuaState.L_CheckStack使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ILuaState
的用法示例。
在下文中一共展示了ILuaState.L_CheckStack方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Str_Byte
private static int Str_Byte( ILuaState lua )
{
string s = lua.L_CheckString(1);
int posi = PosRelative( lua.L_OptInt(2, 1), s.Length );
int pose = PosRelative( lua.L_OptInt(3, posi), s.Length );
if( posi < 1 ) posi = 1;
if( pose > s.Length ) pose = s.Length;
if( posi > pose ) return 0; // empty interval; return no values
int n = pose - posi + 1;
if( posi + n <= pose) // overflow?
return lua.L_Error( "string slice too long" );
lua.L_CheckStack(n, "string slice too long");
for( int i=0; i<n; ++i )
lua.PushInteger( (byte)s[(int)posi+i-1] );
return n;
}
示例2: PushCaptures
private static int PushCaptures(ILuaState lua, MatchState ms, int spos, int epos )
{
int nLevels = (ms.Level == 0 && spos >= 0) ? 1 : ms.Level;
lua.L_CheckStack(nLevels, "too many captures");
for( int i=0; i<nLevels; ++i )
PushOneCapture( ms, i, spos, epos );
return nLevels; // number of strings pushed
}
示例3: TBL_Sort
private static int TBL_Sort( ILuaState lua )
{
int n = AuxGetN(lua, 1);
lua.L_CheckStack(40, ""); /* assume array is smaller than 2^40 */
if (!lua.IsNoneOrNil(2)) /* is there a 2nd argument? */
lua.L_CheckType( 2, LuaType.LUA_TFUNCTION );
lua.SetTop(2); /* make sure there is two arguments */
AuxSort(lua, 1, n);
return 0;
}