예제 #1
0
        public IEnumerator <StackIndexChild> GetEnumerator()
        {
            _log("GetEnumerator()");
            luanet.checkstack(L, 2, "StackIndex.GetEnumerator");
            L.NullCheck();
            var results = new List <StackIndexChild>();
            int index   = luanet.absoluteindex(L, Index);

            if (index != 0 && lua.type(L, index) == LUA.T.TABLE)
            {
                StackAssert.Start(L);
                lua.pushnil(L);
                while (lua.next(L, index))
                {
                    results.Add(new StackIndexChild(this, new[] { LuaValue.read(L, -2, true) }));
                    lua.pop(L, 1);
                }
                StackAssert.End();
            }
            return(results.GetEnumerator());
        }