[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: object addresses in Lua
- From: "Robert G. Jakabosky" <bobby@...>
- Date: Tue, 31 May 2011 03:25:33 -0700
On Tuesday 31, Joerg Walter wrote:
> This touches my question regarding table identifiers.
>
> As I understand it these pointers identify especially tables uniquely.
>
> So when I have
>
> g =
> {
> y = 1,
> z = 2
> }
>
> a =
> {
> b =
> {
> w = 200,
> x = 300,
> ref = g
> },
> v = 100
> }
>
> I get different pointers for a,b and g. The pointer for ref would hopefully
> yield the pointer for g?
Yes, the table instance stored at "a.b.ref" is the same as that stored at "g".
-- changes to one reference
g.zz = 42
-- are seen from the other reference:
assert(a.b.ref.zz == 42)
--
Robert G. Jakabosky