lua-users home
lua-l archive

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


I think I've figured out my odd problem with tolua5.0, as mentioned in

http://lua-users.org/lists/lua-l/2004-01/msg00136.html

but it seems like it should have come up before, if true.

I think my problem is that I have a class MyString and a class MyContainer arranged as:

class MyContainer {
  MyString first_value;
  ...
}

Now, the address of a MyContainer instance and of MyContainer.first_value are the same. This seems to confuse tolua, since now two objects of different types have the same key into the global table.

Hence:

Lua 5.0  Copyright (C) 1994-2003 Tecgraf, PUC-Rio
> c = MyContainer:new()
> =tolua.type(c)
MyContainer
> first = c.first_value
> =tolua.type(c)
MyString

Is there any way around this? I'm using tolua++1.0.2, but I get the same results on plain tolua5.0.

Cheers,

Johann