lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Sorry. I hadn't realized that print(table) yields this pointer.

I suppose there is no difference between a table field and a reference to table field in a table. Table fields do not have a 'primary place' somewhere in the hirarchy of tables?!

Am 31.05.2011 12:28, schrieb Geoff Leyland:
On 31/05/2011, at 10:16 PM, 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?

$ lua
Lua 5.1.4  Copyright (C) 1994-2008 Lua.org, PUC-Rio
g = { y = 1, z = 2 }
a = { b = { w = 200, x = 300, ref = g }, v = 100 }
print(a, a.b, g, a.b.ref)
table: 0x100107270	table: 0x100107590	table: 0x100106a30	table: 0x100106a30

Do you not have a working Lua interpreter?

Cheers,
Geoff