lua-users home
lua-l archive

questions about references and naming

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


I'm working on some C++ interfaces to lua and have run into a couple of 
questions:
1. When you call lua_ref(true) to lock an object that C knows about but 
lua doesn't have any way to reference, does lua_unref unlock the object? 
What if lua_ref(true) is called multiple times on the same lua object? 
is the object only freed when that many lua_unrefs are called?
2. Can you lua_ref(true) an object with no name:
	lua_pushstring("this is a nameless object on the stack");
	ref = lua_ref(true);
Where does such an object live? Can you get to it from within lua?
Note: lock has to be true in this case since lua definitely does not have 
a reference to the string object (right?).
Thanks,
Russ

AltStyle によって変換されたページ (->オリジナル) /