On Tuesday, February 12, 2013 at 2:28 PM, Coda Highland wrote:
That'll keep the object alive indefinitely, though./s/ AdamOn Tue, Feb 12, 2013 at 11:22 AM, James Norton <jamesnorton@gmail.com> wrote:I create a reference to the object in the registry usingref = luaL_ref(L, LUA_REGISTRYINDEX);Then I can retrieve it later usinglua_rawgeti(L, LUA_REGISTRYINDEX,, ref);--James NortonSent with SparrowOn Tuesday, February 12, 2013 at 1:57 PM, Marc Lepage wrote:Hi, I'm doing more with userdata and am just wondering, is it safe to pushthe address of a (full) userdata to keep a reference to it? And remove thatreference in the userdata's __gc function?Basically, I want to store within the C userdata itself, a reference to theLua object version of it. This is so that even if I pass it through C code(without Lua), I can later get back the Lua version of it, for additionalprocessing.Or, is there a better way to turn the address of a (full) userdata, in C,back into its Lua object?