lua-users home
lua-l archive

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

Using C++, lua5.1, luabind 0.7

*** Lua code: ***
class 'TestClass' (ScriptProxy)
function TestClass:__init()
function TestClass:__finalize()

*** C++ code ***
class ScriptProxy
	ScriptProxy(luabind::object self) : self_(self) {};
	luabind::object self_;

// test 1
luaL_dostring(lua_state, "return TestClass()");
luabind::object obj(luabind::from_stack(ls, -1));
// test 2 (results are same)
ScriptProxy* sp = luabind::object_cast<ScriptProxy*>(lua_state,
delete sp;

lua_gc(l_, LUA_GCCOLLECT, 0); // collect garbage

Result: TestClass instance is not deleted, garbage collection ignores him,
it has references anywhere? but where? "_finalaze" method is calling only on
program exit (when "lua_close" function called). How to solve this problem?

Thank you.
View this message in context:
Sent from the Lua list mailing list archive at