new assertion in LuaClass constructor incompatible with unit testing
mck1117 opened this issue · 3 comments
mck1117 commented
This code will cause an assertion failure on the second test:
void test1()
{
lua_State* l = make_lua();
LuaClass<MyType> myLuaType(l, "MyType");
// ... do stuff ...
destroy_lua(l);
}
void test2()
{
lua_State* l = make_lua();
LuaClass<MyType> myLuaType(l, "MyType");
// ... do stuff ...
destroy_lua(l);
}
The assertion in the LuaClass
constructor is currently too strict. Seeing if the same string is already there would likely be more appropriate.
gengyong commented
please pull the newest version.
in new versions, lua class name was stored in lua userdata, and it will be clean in GC.
mck1117 commented
mck1117 commented
It looks like the Lua destructor function (line 678-681) is never called, so the pointer klassName
is never cleared, causing the assertion failures.