lua-users home
lua-l archive

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


Diego Nehab wrote:

You can, on the other hand, keep a strong reference, and unref it during
the garbage colection of your userdatum. That is, as long as you do not
reference it in the associated table, thus forming a cycle :-).


The table *is* the script interface to the object. The table does contain a reference to the userdata, in fact it has the *only* reference to the userdata, so I must rely on the Lua table to determine the lifespan of the object.

I could use the userdata as the object interface in Lua, but then every access would have to go look up the associated table, which seems worse than reimplementing lua_ref(0) myself.

Thanks for the help,

Jason