lua-users home
lua-l archive

Re: C-objects with __gc *and* __index?

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


On Aug 6, 2005, at 21:06:39, Shmuel Zeigerman wrote:
Try to comment the following chunk out, it's unnecessary, IMO:
 luaL_getmetatable( pLuaState, "PACEmaker.Room" );
 lua_pushstring( pLuaState, "__gc" );
 lua_pushcfunction( pLuaState, UKAdventureDeleteRoom );
 lua_settable( pLuaState, -3 );
 luaL_getmetatable( pLuaState, "PACEmaker.Room" );
 lua_pushstring( pLuaState, "__tostring" );
 lua_pushcfunction( pLuaState, UKAdventureRoomToString );
 lua_settable( pLuaState, -3 );
Shmuel,
yes, looks like this was unnecessary, because this still doesn't change anything. Still the same error message. The code I'm running is:
for i=100,1,-1 do
 aRoom = Room.new()
 print( tostring( aRoom ) )
 aRoom = nil
end
I've set the C++ object to printf "room created" and "room deleted" from its constructor/destructor. The exact output I'm getting is:
room created
attempt to concatenate a userdata value
room created
Does that ring a bell for anyone? I'm simply puzzled :-(
Cheers,
-- M. Uli Kusterer
http://www.zathras.de

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