本文整理汇总了C#中ILuaState.Concat方法的典型用法代码示例。如果您正苦于以下问题:C# ILuaState.Concat方法的具体用法?C# ILuaState.Concat怎么用?C# ILuaState.Concat使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ILuaState
的用法示例。
在下文中一共展示了ILuaState.Concat方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: B_Error
public static int B_Error( ILuaState lua )
{
int level = lua.L_OptInt( 2, 1 );
lua.SetTop( 1 );
if( lua.IsString( 1 ) && level > 0 )
{
lua.L_Where( level );
lua.PushValue( 1 );
lua.Concat( 2 );
}
return lua.Error();
}
示例2: CO_AuxWrap
private static int CO_AuxWrap( ILuaState lua )
{
ILuaState co = lua.ToThread( lua.UpvalueIndex(1) );
int r = AuxResume( lua, co, lua.GetTop() );
if( r < 0 )
{
if( lua.IsString( -1 ) ) // error object is a string?
{
lua.L_Where( 1 ); // add extra info
lua.Insert( -2 );
lua.Concat( 2 );
}
lua.Error();
}
return r;
}
示例3: addreturn
/*
** Try to compile line on the stack as 'return <line>'; on return, stack
** has either compiled chunk or original line (if compilation failed).
*/
static LuaStatus addreturn(ILuaState L)
{
LuaStatus status;
int len; string line;
L.PushLiteral("return ");
L.PushValue(-2); /* duplicate line */
L.Concat(2); /* new line is "return ..." */
line = L.ToLString(-1, out len);
if ((status = L.LoadBuffer(line, len, "=stdin")) == LuaStatus.OK)
{
L.Remove(-3); /* remove original line */
//line += sizeof("return")/sizeof(char); /* remove 'return' for history */
line = line.Substring("return".Length);
if (!String.IsNullOrEmpty(line)) /* non empty? */
lua_saveline(L, line); /* keep history */
}
else
L.Pop(2); /* remove result from 'luaL_loadbuffer' and new line */
return status;
}
示例4: multiline
/*
** Read multiple lines until a complete Lua statement
*/
static LuaStatus multiline(ILuaState L)
{
for (; ; )
{ /* repeat until gets a complete statement */
int len;
String line = L.ToLString(1, out len); /* get what it has */
LuaStatus status = L.LoadBuffer(line, len, "=stdin"); /* try it */
if (0 == incomplete(L, status) || 0 == pushline(L, false))
{
lua_saveline(L, line); /* keep history */
return status; /* cannot or should not try to add continuation line */
}
L.PushLiteral("\n"); /* add newline... */
L.Insert(-2); /* ...between the two lines */
L.Concat(3); /* join them */
}
}