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 7, 2005, at 12:24:38, Shmuel Zeigerman wrote:
Uli Kusterer wrote:
int UKAdventureRoomToString( lua_State *pLuaState )
{
 UKRoom* self = UKAdventureRoomGetThis( pLuaState );
 lua_pushfstring( pLuaState, "Room(%lx)", (unsigned long)self );
 return 1;
}
If you work with Lua 5.1w6, then try:
 lua_pushfstring( pLuaState, "Room(%p)", self );
Otherwise, use sprintf and lua_pushstring.
(lua_pushfstring doesn't support %x).
Shmuel,
thanks. I'm still using 5.0.2 right now, but since this was mainly for testing right now, I just changed it to lua_pushstring ( pLuaState, "Room" ); and this call magically started working.
Cheers,
-- M. Uli Kusterer
http://www.zathras.de

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