示例#1
0
        public static int print(IntPtr L)
        {
            int    n = LuaAPI.lua_gettop(L);
            string s = String.Empty;

            LuaAPI.lua_getglobal(L, "tostring");
            for (int i = 1; i <= n; i++)
            {
                LuaAPI.lua_pushvalue(L, -1);  /* function to be called */
                LuaAPI.lua_pushvalue(L, i);   /* value to print */
                if (0 != LuaAPI.lua_pcall(L, 1, 1, 0))
                {
                    return(LuaAPI.lua_error(L));
                }
                s += LuaAPI.lua_tostring(L, -1);

                if (i != n)
                {
                    s += "\t";
                }

                LuaAPI.lua_pop(L, 1);
            }
            UnityEngine.Debug.Log("LUA: " + s);
            return(0);
        }