I have a function in lua that accepts a userdata object.
function Class:AttachToUserdataObject(userdataObject)
userDataObject.tableAttached = self
end
But later on, when I am using the same userdata object, I can't find it - userdataObject.tableAttached
is nil. I feel like I don't fully understand the way userdata objects work yet.
Is there any way of binding the object to userdata other than creating a global table that has ids of all userdata objects (they have unique id) and references to tables?
I would like to keep it as elegant as I can, but without the access to C++ code I guess I can sacrifice some elegancy if it just works.