Beispiel #1
0
            public static HNode Clone(HNode other)
            {
                if (other == null)
                {
                    return(null);
                }
                var node = new LuaTable.HNode();

                node.Index = other.Index;
                node.Key   = other.Key == null ? null : StkId.Clone(other.Key);
                node.Val   = other.Val == null ? null : StkId.Clone(other.Val);
                node.Next  = other.Next == null ? null : Clone(other.Next);
                return(node);
            }
Beispiel #2
0
        public static LuaTable Clone(LuaTable other)
        {
            if (other == null)
            {
                return(null);
            }
            var ret = (LuaTable)other.MemberwiseClone();

            if (other.ArrayPart == null)
            {
                ret.ArrayPart = null;
            }
            else
            {
                ret.ArrayPart = new StkId[other.ArrayPart.Length];
                for (var i = 0; i < other.ArrayPart.Length; i++)
                {
                    ret.ArrayPart[i] = StkId.Clone(other.ArrayPart[i]);
                }
            }

            if (other.HashPart == null)
            {
                ret.HashPart = null;
            }
            else
            {
                ret.HashPart = new LuaTable.HNode[other.HashPart.Length];
                for (var i = 0; i < other.HashPart.Length; i++)
                {
                    ret.HashPart[i] = LuaTable.HNode.Clone(other.HashPart[i]);
                }
            }

            return(ret);
        }