[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Bug candidate in Lua 5.1.2 ?
- From: "steve donovan" <steve.j.donovan@...>
- Date: Fri, 2 Nov 2007 15:19:55 +0200
Ah, but b and a are references to the _same table_!
Assignment merely copies references; if you want a copy, you have to
do it yourself.
steve d.
On 11/2/07, G.H. <code933k@gmail.com> wrote:
> Hello everyone.
>
> I am pretty curious about this because it looks weird.
> You'll see, it appears to be that table.remove() isn't
> working properly in Lua 5.1.2 or, at least, it has
> unpleasant "secondary effects" when modifying values
> previously assigned from _different variables_ :
>
> a = {3,7,8}
> return #a
> 3
> b = a
> return #b
> 3
> table.remove(b, 1)
> return #b
> 2
> return #a
> 2
>
> I have tried in two different computers obtaining the
> same results. Any ideas or teachings about this?
> I hope it'd be my imagination...
>
> Thank you in advance -- Mario
>