|
Diego Nehab wrote:
When you do ref=lua_ref(L, 1), Lua reserves space in a reference vector for that object, saves the object in that vector and returns an index to you. When you call lua_getref(L, ref), Lua pushes the corresponding index from that vector in the Lua stack. When you call lua_unref(L, ref), Lua marks the position on the vector as free for further lua_ref calls so that the value of ref is meaningless after the call to lua_unref. (snip) Did that answer your question?
Yes, that did. I guess I need to do something like: lua_getref(L, ref); lua_unref(L); ref = lua_ref(L, 0); ...to properly unlock an object then.I have to say -- I'm sure you had your reasons for designing the ref system the way you did (lua_ref() always returns a different value), but IMHO a more conventional method would sure make my life easier. Not that I can't hack around it, but I guess I don't understand the motivation behind the current implementation.
Jason 379