|
For example, If I have a table obj and a subtable obj.child. I want obj.child.parent to be obj itseld. Then If I modify obj.child.parend, obj is also modified (because it is the same object)
My understanding is that what gets pushed on the stack is the pointer to the table, not a copy of the table. If you use lua_pushvalue() and lua_remove() (as Ashwin suggested) I think you'll get exactly what you want (but I might be wrong.)
When in doubt about the stack status I use the StackDump() function that Roberto describes in his book, very helpful to trace operations on stack!
Remo D.