LuaPushLiteral() public static method

public static LuaPushLiteral ( LuaState L, CharPtr s ) : void
L LuaState
s CharPtr
return void
示例#1
0
        static int loadline(LuaState L)
        {
            int status;

            Lua.LuaSetTop(L, 0);
            if (pushline(L, 1) == 0)
            {
                return(-1);                 /* no input */
            }
            for (; ;)
            {              /* repeat until gets a complete line */
                status = Lua.LuaLLoadBuffer(L, Lua.LuaToString(L, 1), Lua.LuaStrLen(L, 1), "=stdin");
                if (incomplete(L, status) == 0)
                {
                    break;                              /* cannot try to add lines? */
                }
                if (pushline(L, 0) == 0)                /* no more input? */
                {
                    return(-1);
                }
                Lua.LuaPushLiteral(L, "\n");          /* add a new line... */
                Lua.LuaInsert(L, -2);                 /* ...between the two lines */
                Lua.LuaConcat(L, 3);                  /* join them */
            }
            Lua.lua_saveline(L, 1);
            Lua.LuaRemove(L, 1);              /* remove line */
            return(status);
        }