lua-users home
lua-l archive

Re: tolua++: passing C++ objects to Lua?

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


Enrico Colombini wrote:
Leigh McRae wrote:
TOLUA_API void tolua_pushusertype (lua_State* L, void* value, const char* type)
Class Foo;
Foo* pFoo = new Foo();
tolua_pushusertype( L, pFoo, "Foo" );
 Off hand I can't remeber how to determine ownership of pFoo.
Thanks. Ownership detection should not be a problem in my case.
(looks like I'll probably have to design a lighter interface for performance reasons, though).
Just wondering... Isn't there a way of specifying the data type without using a string lookup? Something like this:
tolua_pushusertype(L, pFoo, tolua_type_Foo);
Where tolua_type_Foo is a special type structure defined somewhere by tolua? This will save a possibly heavy (hash)map lookup for compile-time known types.
Cheers,
Andrea.

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