本文整理汇总了C#中ILuaState.XMove方法的典型用法代码示例。如果您正苦于以下问题:C# ILuaState.XMove方法的具体用法?C# ILuaState.XMove怎么用?C# ILuaState.XMove使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ILuaState
的用法示例。
在下文中一共展示了ILuaState.XMove方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AuxResume
private static int AuxResume( ILuaState lua, ILuaState co, int narg )
{
if(!co.CheckStack(narg)) {
lua.PushString("too many arguments to resume");
return -1; // error flag
}
if( co.Status == ThreadStatus.LUA_OK && co.GetTop() == 0 )
{
lua.PushString( "cannot resume dead coroutine" );
return -1; // error flag
}
lua.XMove( co, narg );
ThreadStatus status = co.Resume( lua, narg );
if( status == ThreadStatus.LUA_OK || status == ThreadStatus.LUA_YIELD )
{
int nres = co.GetTop();
if(!lua.CheckStack(nres+1)) {
co.Pop(nres); // remove results anyway;
lua.PushString("too many results to resume");
return -1; // error flag
}
co.XMove( lua, nres ); // move yielded values
return nres;
}
else
{
co.XMove( lua, 1 ); // move error message
return -1;
}
}
示例2: CO_Create
private static int CO_Create( ILuaState lua )
{
lua.L_CheckType( 1, LuaType.LUA_TFUNCTION );
ILuaState newLua = lua.NewThread();
lua.PushValue( 1 ); // move function to top
lua.XMove( newLua, 1 ); // move function from lua to newLua
return 1;
}
示例3: AuxResume
private static int AuxResume( ILuaState lua, ILuaState co, int narg )
{
if( co.Status == ThreadStatus.LUA_OK && co.GetTop() == 0 )
{
lua.PushString( "cannot resume dead coroutine" );
return -1; // error flag
}
lua.XMove( co, narg );
ThreadStatus status = co.Resume( lua, narg );
if( status == ThreadStatus.LUA_OK || status == ThreadStatus.LUA_YIELD )
{
int nres = co.GetTop();
co.XMove( lua, nres ); // move yielded values
return nres;
}
else
{
co.XMove( lua, 1 ); // move error message
return -1;
}
}