LuaInterface.LuaDLL.lua_pop C# (CSharp) Method

lua_pop() public static method

public static lua_pop ( IntPtr luaState, int amount ) : void
luaState System.IntPtr
amount int
return void
        public static void lua_pop(IntPtr luaState, int amount)
        {
            LuaDLL.lua_settop(luaState, -(amount) - 1);
        }

Usage Example

示例#1
0
        public static int print(IntPtr L)
        {
            // For each argument we'll 'tostring' it
            int    n = LuaDLL.lua_gettop(L);
            string s = String.Empty;

            //LuaDLL.lua_getglobal(L, "debug");
            //LuaDLL.lua_getfield(L, -1, "traceback");
            //LuaDLL.lua_pushvalue(L, 1);
            //LuaDLL.lua_pushnumber(L, 2);
            //LuaDLL.lua_call(L, 2, 1);
            //n = LuaDLL.lua_gettop(L);

            LuaDLL.lua_getglobal(L, "tostring");

            for (int i = 1; i <= n; i++)
            {
                LuaDLL.lua_pushvalue(L, -1);                  /* function to be called */
                LuaDLL.lua_pushvalue(L, i);                   /* value to print */
                LuaDLL.lua_call(L, 1, 1);

                if (i > 1)
                {
                    s += "\t";
                }
                s += LuaDLL.lua_tostring(L, -1);

                LuaDLL.lua_pop(L, 1);                  /* pop result */



                //LuaDLL.PrintCmd(s);
            }
            Debug.Log("LUA: " + s);

            return(0);
        }
All Usage Examples Of LuaInterface.LuaDLL::lua_pop
LuaDLL