lua-users home
lua-l archive

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

Let's say I have two classes:

class B
    int foo;

class A
    B b;

In c++, if I say:

 A a; = 1;
 B b = a.b; = 2; 

then will have value 1, and will have value 2.

But in lua, if I say:

a = A() = 1
b = a.b = 2

Then both and will have value 2, because lua handles userdata by reference.  Is there any way to override this behavior, so it behaves like c++?