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


C# ILuaState.Remove方法代码示例

本文整理汇总了C#中ILuaState.Remove方法的典型用法代码示例。如果您正苦于以下问题:C# ILuaState.Remove方法的具体用法?C# ILuaState.Remove怎么用?C# ILuaState.Remove使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ILuaState的用法示例。


在下文中一共展示了ILuaState.Remove方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: 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;
 }
开发者ID:ygrenier,项目名称:LuaN,代码行数:24,代码来源:Program.cs

示例2: SearchPath

		private static string SearchPath( ILuaState lua,
			string name, string path, string sep, string dirsep )
		{
			var sb = new StringBuilder(); // to build error message
			if( !String.IsNullOrEmpty(sep) ) // non-empty separator?
				name = name.Replace( sep, dirsep ); // replace it by `dirsep'
			int pos = 0;
			while(PushNextTemplate(lua, path, ref pos))
			{
				var template = lua.ToString(-1);
				string filename = template.Replace( LUA_PATH_MARK, name );
				lua.Remove( -1 ); // remove path template
				if( Readable( filename ) ) // does file exist and is readable?
					return filename; // return that file name
				lua.PushString( string.Format( "\n\tno file '{0}'", filename) );
				lua.Remove( -2 ); // remove file name
				sb.Append( lua.ToString(-1) ); // concatenate error msg. entry
			}
			lua.PushString( sb.ToString() ); // create error message
			return null; // not found
		}
开发者ID:bharath1097,项目名称:UniLua,代码行数:21,代码来源:LuaPkgLib.cs

示例3: loadline

 /*
 ** Read a line and try to load (compile) it first as an expression (by
 ** adding "return " in front of it) and second as a statement. Return
 ** the final status of load/call with the resulting function (if any)
 ** in the top of the stack.
 */
 static LuaStatus loadline(ILuaState L)
 {
     LuaStatus status;
     L.SetTop(0);
     if (0 == pushline(L, true))
         return (LuaStatus)(-1);  /* no input */
     if ((status = addreturn(L)) != LuaStatus.OK)  /* 'return ...' did not work? */
         status = multiline(L);  /* try as command, maybe with continuation lines */
     L.Remove(1);  /* remove line from the stack */
     L.Assert(L.GetTop() == 1);
     return status;
 }
开发者ID:ygrenier,项目名称:LuaN,代码行数:18,代码来源:Program.cs

示例4: pushargs

 /*
 ** Push on the stack the contents of table 'arg' from 1 to #arg
 */
 static int pushargs(ILuaState L)
 {
     int i, n;
     if (L.GetGlobal("arg") != LuaType.Table)
         L.Error("'arg' is not a table");
     n = L.LLen(-1);
     L.CheckStack(n + 3, "too many arguments to script");
     for (i = 1; i <= n; i++)
         L.RawGetI(-i, i);
     L.Remove(-i);  /* remove table from the stack */
     return n;
 }
开发者ID:ygrenier,项目名称:LuaN,代码行数:15,代码来源:Program.cs

示例5: docall

 /*
 ** Interface to 'lua_pcall', which sets appropriate message function
 ** and C-signal handler. Used to run all chunks.
 */
 static LuaStatus docall(ILuaState L, int narg, int nres)
 {
     LuaStatus status = 0;
     int base_ = L.GetTop() - narg;  /* function index */
     L.PushFunction(msghandler);  /* push message handler */
     L.Insert(base_);  /* put it under function and args */
     globalL = L;  /* to be available to 'laction' */
     Console.CancelKeyPress += Console_CancelKeyPress;
     //signal(SIGINT, laction);  /* set C-signal handler */
     status = L.PCall(narg, nres, base_);
     //signal(SIGINT, SIG_DFL); /* reset C-signal handler */
     Console.CancelKeyPress -= Console_CancelKeyPress;
     L.Remove(base_);  /* remove message handler from the stack */
     return status;
 }
开发者ID:ygrenier,项目名称:LuaN,代码行数:19,代码来源:Program.cs


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