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


C# ILuaState.ToLString方法代码示例

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


在下文中一共展示了ILuaState.ToLString方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: 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 */
     }
 }
开发者ID:ygrenier,项目名称:LuaN,代码行数:20,代码来源:Program.cs

示例3: incomplete

 /*
 ** Check whether 'status' signals a syntax error and the error
 ** message at the top of the stack ends with the above mark for
 ** incomplete statements.
 */
 static int incomplete(ILuaState L, LuaStatus status)
 {
     if (status == LuaStatus.ErrSyntax)
     {
         int lmsg;
         String msg = L.ToLString(-1, out lmsg);
         //if (lmsg >= marklen && String.Compare(msg + lmsg - marklen, EOFMARK) == 0)
         if (lmsg >= marklen && msg.EndsWith(EOFMARK))
         {
             L.Pop(1);
             return 1;
         }
     }
     return 0;  /* else... */
 }
开发者ID:ygrenier,项目名称:LuaN,代码行数:20,代码来源:Program.cs


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