garbage collection - Lua userdata gc -


Is it possible to capture the context of a lua object for a piece of leaked usager? (Like a table, or the second piece of user data?). In fact, what should I know:

Can I create a piece of user data like this when GC runs, then user data can say: "Hey! I hold the references of these others

Edit: Answer to lhf:

Suppose I have:

  struct vertex {Double X, Y, z; } Straight quaternion {double w, x, y, z; }  

Now, I can:

  struct Foo {Vertex v; Quaternion q; }  

but instead I think that:

  struct bar {Vertex * v; Quaternion * q; }  

[i.e. Suppose, the Vertex & amp; Quaternion is actually a big piece of user data].

Now, suppose I have a LEA user function that takes UserDataVertex and UserDate Quaternion and creates a UserData bar (I do not want to use a UserDoq because I want to save space) - so I do not want GC-ED for UserData Vertex * * * * * * Quantanians *

Is it possible to capture the reference of the object object for a piece of data user?

No. A. Userdata can not hold an indicator for another Lua object. If you want to use User Data to keep any other LEA object alive, you have to use it for weak table . Roberto's book A.


Comments

Popular posts from this blog

windows - Heroku throws SQLITE3 Read only exception -

lex - Building a lexical Analyzer in Java -

python - rename keys in a dictionary -